Can I get at the <meta> elements of a mapping? The normal elements are accessible via SessionFactory.getClassMetadata, but I can't see how to get to the meta elements.
Alternatively, is there some way to mark a property in a mapping file so that I can get its name in java code?
I'll explain what I'm trying to do, in case anyone can point out a better way. Many of the objects in my app have a "point-of-contact" member, which is the higher-level object that is responsible for that object. For example, Book has getAuthor, Pet has getOwner, Car has getRegisteredOwner, Child has getLegalGuardian, etc. How do I get the name of the property (or specifically, the many-to-one mapping) of those point-of-contact members, so that I can dynamically build an HQL query to get it from the object that I start with?
The only solution I've come up with so far is to put the mapping name as a class member of the "owned" object, but I don't want to put hibernate details in my POJO code if there's an alternative.
|