Hi all,
I use AR with a postgreSQL 8.4 database.
I have tables with Timestamp fields I fill with date containing milliseconds,
like "2011-01-01 08:00:00.123".
When I save a record with MyObject.Save(), the date is successfully stored with
milliseconds.
My object contains one or more fields like that (or a composed primarykey
contains that...):
[Property("My_Date_Field", ColumnType = "Timestamp")]
public virtual DateTime MyDate
{
get { return m_mydate; }
set { m_mydate = value; }
}
In order to retrieve this record, an SQL request is used. See below the
function I use :
private static IList<Object> ExecuteSQL(Type type, string request)
{
return (IList<Object>)ActiveRecordMediator.Execute(type,
delegate(ISession session, object instance)
{
return session.CreateSQLQuery(request)
.List<Object>();
}, null);
}
This function works but when I try to retrieve my record containing a datetime
with milliseconds, the milliseconds are truncated.
I have tried also to use something like that :
ActiveRecordMediator.FindAll(typeof(type), new DetachedQuery("from My_Object
where ...)));
The result is good (with milliseconds), but :
1. it is very slow compared to SQL query,
2. The code I maintain will certainly have too much impact with this solution
(but if it's the only one, I will do with that...)
If someone have a solution to retrieve milliseconds with SQL query, it will be
very helpful !
Many thanks,
Laurent.
--
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en.