As part of a skinny DAO framework built on top of Hibernate, I'm trying to automate some of the way bi-directional one-to-many relationships are handled. Specifically, upon saving a new child object, it would automatically add it to the relevant collection(s) of its parent object(s). To keep a lot of cruft out my POJOs, I'd like to discover (child property) --> (parent collection) mappings at runtime.
After winding my way through the javadocs, the way from ClassMetadata to the mapping I want seems kinda murky, passing through PersistentCollectionType and possibly several other classes along the way.
Is there an easy way to do this kind of thing?
|