Hibernate version:
NHibernate-1.2.0.GA
Mapping documents:
Hi. I had a relationship 1:1 that was not working well. The accessors and the the member variables of the :1 was not matching when the class was lazy loaded.
Code:
class Foo
{
private long id;
private int anyValue;
public long Id
{get;set;}
public int AnyValue
{get;set;}
}
If I load Foo with get or load there is no problem. But lazy loading Foo,
foo.AnyValue != foo.anyValue.
I was pretty sure that my mapping was correct. I tried a lot of things like constrained, outer-join, cascades, but the only thing that worked was to set lazy to false at the many-to-one side.
I understand that this can be the correct behaviour of NHibernate, but I think that it could be more clear documented. If not, anyone can point it to me?
If I am right I hope this post can help others with the same problem.