Hi Hibernate experts
Say, my hibernate-mapping has the below entry
<class name="foo.Person" table="person" lazy="false"> <composite-id name="personid" class="foo.PersonId"> <key-property name="FIRST_NAME" type="string" column="FIRST_NAME"/> <key-property name="LAST_NAME" type="string" column="FIRST_NAME"/> </composite-id> <property name="AGE" type="int" node="AGE" column="AGE"/> </class>
Is there any way I could use org.hibernate.metadata.ClassMetadata or its subclasses like AbstractEntityPersister SingleTableEntityPersister to find the composite-id class name "foo.PersonId"? I though it should be easy but I just cannot find it even by examining the ClassMetaData object in debug mode. I could use getIdentifierPropertyName and getPropertyColumnNames to find personid and FIRST_NAME and LAST_NAME, but just cannot get the class name "foo.PersonId".
I notice org.hibernate.cfg.Configuration has getClassMappings and I could see the foo.PersonId is there, but I use Spring to initialize hibernate SessionFactory and I do not use cfg.xml, so I do not know how to get an instance of Configuration for my need.
Thanks for any advice in advance Gerry
|