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.  [ 2 posts ] 
Author Message
 Post subject: ICompositeUserType Many-To-One relationships
PostPosted: Thu Aug 21, 2008 3:57 am 
Newbie

Joined: Mon Nov 19, 2007 12:12 am
Posts: 5
ICompositeUserType documentation indicates that

/// A ICompositeUserType may be used in almost every way
/// that a component may be used. It may even contain many-to-one
/// associations.

I have tried creating an ICompositeUserType containing (or emulating) many-to-one associations. I did this by having NullSafeSet save a foreign key and type and NullSafeGet load this information and use this to create and return an entity using session.InternalLoad( TypeName, ForeignKey, true, false ).

For the most part this works. However the entities referenced through this composite type are also referenced elsewhere through a many-to-one relationship. When I load the composite type and therefore the referenced entities they are not placed in the PersistenceContext EntitiesEntry and later when the same entities are loaded through other many-to-one relationship new instances are created (thus I have duplicate instances when I should have just one)

I think this might be because cascades are not occurring into ICompositeUserType elements (in particular when used as a type on an element in a map or list).

Does anyone have any suggestions on how to correctly use ICompositeUserType to persist out entities? I have a number of use cases where we would like to persist properties that are essentially entities (or composites of entities) but cannot be persisted correctly using NHibernate default mechanisms.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 02, 2008 6:06 am 
Newbie

Joined: Thu Apr 03, 2008 4:16 am
Posts: 18
Hi Benjamin
I am facing issues loading collection in complex domain object typically one-to-many relation as mentioned in the post below. Since I think you had a similar issue could you help us know if you have solved this problem or is your problem different from what we are facing.

http://forum.hibernate.org/viewtopic.php?t=990195


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.