Thank you, Gustavo. Actually I am using Fluent, although none of my questions is specifically about the Fluent syntax. Regarding the ticks, I eventually implemented IUserType and now it works like charm (I had seen the built-in Ticks data type but couldn't get it working).
As to the second question, I *do* want to have a relation in the entities model between the two classes. I just want this relation to be special: not just an equality between two fields, but a "greater than" operator. On Dec 27, 1:59 pm, Gustavo Ringel <[email protected]> wrote: > First of all you are trying out NHibernate and not Fluent NHibernate right? > because i don't see questions about Fluent NHibernate there. > For Ticks you have the Ticks NHibernate > typehttp://nhforge.org/doc/nh/en/index.html#mapping-types > > <http://nhforge.org/doc/nh/en/index.html#mapping-types>Regarding the query > if there is no relation in the Entities model between the class and you > still need to make that join you can use CreateSQLQuery and then transform > the result to an entity you. > > Gustavo. > > > > > > > > On Wed, Dec 22, 2010 at 9:14 PM, Ilya Kogan <[email protected]> wrote: > > 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]<nhusers%[email protected] > > > > > . > > For more options, visit this group at > >http://groups.google.com/group/nhusers?hl=en. -- 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.
