[fluent-nhib] Re: Problems with inheritance mapping

2009-08-26 Thread Paul Batum
Hah! I should have asked for your saving code days and days ago. Glad you figured it out Niklas. On Wed, Aug 26, 2009 at 7:45 AM, Stuart Childs wrote: > > That's how it's supposed to work because NH 2.0 changed the default > flush mode to Commit (see > > http://markmail.org/message/pjqelacrqu5jo

[fluent-nhib] Re: Problems with inheritance mapping

2009-08-25 Thread Stuart Childs
That's how it's supposed to work because NH 2.0 changed the default flush mode to Commit (see http://markmail.org/message/pjqelacrqu5jormi#query:+page:1+mid:gte3kefsewskmgfa+state:results). Previously it was set to Auto, so NHibernate would flush the session before executing a query, making sure

[fluent-nhib] Re: Problems with inheritance mapping

2009-08-25 Thread Niklas Wendel
I actually got it working yesterday, but I haven't had time to write it here. I didn't create a transaction around my SaveOrUpdate call in the small test application originally, not sure why. As soon as I added a transaction everything worked fine. Is that how it is supposed to work? I guess t

[fluent-nhib] Re: Problems with inheritance mapping

2009-08-24 Thread Paul Batum
Niklas, I can't see anything wrong with the xml so I suspect your problem must be to do with how you are adding/saving the entities. Can you show me the relevant code? On Fri, Aug 21, 2009 at 11:41 PM, Niklas Wendel wrote: > > I have now upgraded and tried with the 1.0 RC and I am still seeing >

[fluent-nhib] Re: Problems with inheritance mapping

2009-08-21 Thread Niklas Wendel
I have now upgraded and tried with the 1.0 RC and I am still seeing the same behavior which is that the CondExpr_id column is always null in the database. I have tried both with and without .Inverse(). I have also changed the model slightly and removed the NotCond class and replaced it with a boo

[fluent-nhib] Re: Problems with inheritance mapping

2009-08-17 Thread Paul Batum
I've ran out of ideas based on the code I've seen so far. I am thinking it might be best if you migrate to using the recently released 1.0 RC version of FNH as I can give you better assistance when working off that codebase. If the problem still persists after migrating to 1.0 RC, can you please ex

[fluent-nhib] Re: Problems with inheritance mapping

2009-08-16 Thread Niklas Wendel
Unfortunatley adding an Inverse() made no difference. /Niklas On Aug 16, 2:11 pm, Paul Batum wrote: > Try this: > m.HasMany(a => a.Exprs) >    .Cascade.All() >    .Inverse(); > > Also, for your NotExp you want the References() method not HasOne (HasOne is > for One-to-One mappings which are qui

[fluent-nhib] Re: Problems with inheritance mapping

2009-08-16 Thread Paul Batum
Try this: m.HasMany(a => a.Exprs) .Cascade.All() .Inverse(); Also, for your NotExp you want the References() method not HasOne (HasOne is for One-to-One mappings which are quite rare). On Sun, Aug 16, 2009 at 9:22 PM, Niklas Wendel wrote: > > Thank you for the help. I turned off lazy-load

[fluent-nhib] Re: Problems with inheritance mapping

2009-08-16 Thread Niklas Wendel
Thank you for the help. I turned off lazy-loading by implementing a ClassMap where I set up the mappings for the Expr hierarchy of classes like this: public ExprMap() { Not.LazyLoad(); Id(x => x.Id); Map(x => x.ExprType); DiscriminateSubClassesOnColumn("Type") .SubClass

[fluent-nhib] Re: Problems with inheritance mapping

2009-08-16 Thread Paul Batum
Yes even this is the expected behavior. Try adding a virtual method to Expr and override it in CondExpr and call it. You should find that the CondExpr override gets called. If you really need to cast, there are a few tricks you can use, some of them are listed here: http://stackoverflow.com/questi

[fluent-nhib] Re: Problems with inheritance mapping

2009-08-16 Thread Niklas Wendel
Hej! You understood it correct. Unfortunatley the behavior that you describe where the ExprProxy gets turned into a CondExpr isn't happening. Do I have to do something special to make it happen? Right now I have a line like this in my ExprType case statement: var condExpr = root.Expr as CondEx

[fluent-nhib] Re: Problems with inheritance mapping

2009-08-15 Thread Paul Batum
Hi Niklas, Unless I am misunderstanding, the behavior you describe of a Expr proxy being loaded is correct. When NHibernate loads your Root object, the Root.Expr property gets loaded with a Expr proxy. When you then try to use the Expr object, NH goes to the DB, finds out the type of object (such