Hi all,
I've started trying out Fluent HNibernate a week ago, and currently I
have three conundrums. I've been looking for solutions all over the
web with no success, and I'll be really happy if you can help.
The application accesses legacy tables that I cannot change, so some
of the relations are quite complicated and non-standard.
1. A Ticks column
There's an Oracle number column that represents the number of ticks in
a date. I'd like to have a DateTime property in my model class:
public virtual DateTime Time { get; set; }
and map it to the ticks column. I tried to use
.CustomType(typeof(long))
but it didn't work, NHibernate threw a System.InvalidCastException (my
guess is that there was a problem casting between an Int64 and a
DateTime).
Must I implement an IUserType, or is there a simpler way?
2. A custom 'ON' clause
There's an Intervals table with columns START_TIME and END_TIME.
There's an Events table with column TIME.
In the mapping I need to create a relation that would produce the
following JOIN:
Events JOIN Intervals
ON Events.TIME >= Intervals.START_TIME
AND Events.TIME <= Intervals.END_TIME
I've seen someone mention named queries, but I have no idea how to use
a named query as an 'ON' clause.
Is there a way to make such a relation?
--
You received this message because you are subscribed to the Google Groups
"nhusers" 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/nhusers?hl=en.