-->
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: Help with implementing UserCollectionType
PostPosted: Tue Oct 11, 2005 4:36 pm 
Newbie

Joined: Tue Oct 11, 2005 4:18 pm
Posts: 8
Location: Washington, DC
I'm trying to implement a custom UserCollectionType that is intended to be a PersistentMap, a map-based view of arbitrary JavaBean style objects that gets stored in a database. I'm using CGLIB's BeanMap as my underlying implementation. I'm basing what I'm trying to do on the usercollection List example included in the hibernate 3.1 distribution, but I can't get it to work properly. I succeed in storing my map of the java beans properties in the database, but it fails to restore them on load.

I'm just not sure about how this is supposed to work. It appears based on the usercollection example that hibernate may try to recreate the map by calling instantiate() in the user type class followed by replaceElements(), but this isn't clear. The usercollection example seems very thin. Could anyone point me to a more substantive example? I don't see much of anything in hibernate documentation, faq, or book. I also see nothing at all that illustrates how to create a custom collection type in cases where the object you are trying to persist is not already a java collection type. An example of doing this would be very helpful, since it would show how you need to implement the PersistentCollection methods and give some sense of what they are doing.

Thanks in advance,
Mark Becker


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 12, 2005 4:44 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you wont find much about this because its a fairly new feature.

the example in the junit tests is the best you will find and it covers the case where you are wrapping a collection that is a subclass of one of the Java2 collections - if you want to have something that is a non java2 collection then you basically need to redo what is done in the existing collectionpersisters; in there you can see all the dreadfull details you need to take care of when persisting collections.

_________________
Max
Don't forget to rate


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.