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
|