These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Loading childs with parent when child FK is to parent uq col
PostPosted: Fri Nov 30, 2007 3:21 pm 
Beginner
Beginner

Joined: Tue Nov 27, 2007 1:25 pm
Posts: 24
Hello,

I have the following database schema:
Document <-- DocumentImage

Document table has PK (identity) DocumentId and also has unique column DocumentNumber;
DocumentImage has PK (identity) DocumentImageId and a FK column DocumentNumber which refers to Document.DocumentNumber (note: not to PK, but to unique column).

Document (as .NET class) has a list of DocumentImage classes. How to write a correct mapping file so that DocumentImages are loaded along with Document?

At this momemt if one Document is selected from database, e.g. with DocumentId = 5 and DocumentNumber = 123, then there goes another select for DocumentImages with "<..> WHERE IMAGE.DocumentNumber = 5" <-- it should have the following WHERE clause: "WHERE IMAGE.DocumentNumber = 123".

Regards,
Mindaugas


Top
 Profile  
 
 Post subject:
PostPosted: Fri Nov 30, 2007 5:08 pm 
Expert
Expert

Joined: Fri May 13, 2005 11:13 am
Posts: 292
Location: Rochester, NY
This is not currently possible. The images can reference the document using <many-to-one ... property-ref="DocumentNumber" />, but a similar facility for collections will only be available with the 2.0 release of NH.

See http://jira.nhibernate.org/browse/NH-1134 and http://jira.nhibernate.org/browse/NH-1162


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 02, 2007 5:34 am 
Beginner
Beginner

Joined: Tue Nov 27, 2007 1:25 pm
Posts: 24
Maybe you could suggest how to load childs along with parent in this situation?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.