I want to create a generic method of creating backups of my mapped entities.
They all look like this:
Code:
<class name="de.bauerlive.ngshop.data.KNA1GRP" table="kna1grp">
<cache usage="nonstrict-read-write"/>
<composite-id>
<key-property column="MANDT" length="4" name="mandt" type="string"/>
<key-property column="GRPID" length="12" name="grpid" type="string"/>
</composite-id>
<property column="INFO" length="80" name="info" type="string"/>
</class>
I already found out, that i can iterator over all mapped classes, using the sessionfactory's getAllClassMetadata.
But if i use now the ClassMetaData's getIdentifierPropertyName it returns null (i assume, because i have a composite id). The problem is that the fields of the the composite-id do not show up in the getPropertyNames String array.
Further, some of the classes have a named identifier (mappedBy); so how can I "dive" into that class, too, in the same gerenic approach ?