From: Boyan T. (JIRA) <nh...@gm...> - 2011-05-16 06:22:47
|
[ http://216.121.112.228/browse/NH-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=21081#action_21081 ] Boyan Trushev commented on NH-2704: ----------------------------------- Hi Fabio, Thanks for the quick reply! >NH have to hit the DB to know the value of the property holding the relation, hitting it he can initialize the object. Why should NH hit the DB to know the value of the property? Couldn't this be done on accessing of the "lazy" property? The object containing the property is a proxy and it could check that the property is still not initialized and then hit the DB. That's exactly what I achieved with the patch I proposed in my previous comment. Have you had a look at it? >In practice the one-to-one through FK is not a real one-to-one and it can be transformed to a one-to-many easily. The real one-to-one is through PK. In our current project we use POCOs and for one-to-one relation there is a single property to hold the relation, it cannot be easily transformed to one-to-many as for one-to-many we will need a list rather than just a property - which is unacceptable in our case. > Bidirectional one-to-one relation through FK (using property-ref) proxiable > --------------------------------------------------------------------------- > > Key: NH-2704 > URL: http://216.121.112.228/browse/NH-2704 > Project: NHibernate > Issue Type: Improvement > Components: Core > Affects Versions: 3.2.0Alpha3 > Reporter: Boyan Trushev > Priority: Minor > Attachments: NH2704.patch, NH2704_fix.patch > > > Hi, > In our project we use one-to-one relations that are not referencing same primary key, instead property-ref is used to specify the referenced property. In this case however we have noticed that lazy="proxy" doesn't work as expected - the "lazy" objects are eagerly loaded on loading of the parent objec -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://216.121.112.228/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |