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.  [ 5 posts ] 
Author Message
 Post subject: Collection mapping with user extended collection types?
PostPosted: Fri Jan 07, 2005 6:56 pm 
Beginner
Beginner

Joined: Wed Dec 31, 2003 1:40 pm
Posts: 25
Hi, this is a general question. I read in the documentation that Hibernate does Collection mapping with lazy loading by silently replacing Set, List, etc. with the respective Hibernate extensions. That is great. But what if my associations in my domain model use user-extended associations already?

Our beans all use a user extended collection called AssociationSet. Will I have to replace this and remove all the extra functionality in order to use Hibernate's collection lazy loading? Or would there be a way for me to integrate this with Hibernate's collection implementations more gracefully?

I was thinking of using the Hibernate collections directly and explicitly and then extending those. But that would make all the business objects dependent on Hibernate.

Ideally I think the hibernate collections would be on the fly generated extensions, just like the persistent entity classes are. What's the thinking here?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 07, 2005 7:12 pm 
Newbie

Joined: Thu Sep 23, 2004 2:59 pm
Posts: 5
I had the exact same problem in migrating to Hibernate. Our domain model only refers to the collection interfaces (e.g. List), but we have custom implementations that would take a long time to replace with a different strategy.

I solved the problem with a bit of a "hack" solution, because I didn't see a way that user customization was intended with the persistent collections. This would be a nice extention point, BTW, hint hint. :-)

What I did was extend the Hibernate implementations to add some of my own functionality (e.g. extended the Bag class). But in order to get Hibernate to use the class, I had to also extend the corresponding Bag class in the mapping package and the BagType class in the type package.

Then I had to programmatically loop through the objects in the Configuration instance (after loading all the config files) and replace "Bag" mappings with my own "Bag" extension. It was a bit of a pain.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 07, 2005 7:22 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Please open up a feature request in Hibernate3 branch for this, lets see what and if any solution can be found. I'd agree that it at least needs documentation.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 07, 2005 7:56 pm 
Newbie

Joined: Thu Sep 23, 2004 2:59 pm
Posts: 5
http://opensource.atlassian.com/projects/hibernate/browse/HHH-83


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 15, 2007 1:30 pm 
Newbie

Joined: Mon Oct 15, 2007 1:24 pm
Posts: 1
I need the same feature of able to user extended collection.

Seems to me feature request HHH-83 was implemented.
Can anyone give an example of how to map a collection
using user extended collection?


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