-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Howto get Fields of mapped class ?
PostPosted: Sat Mar 27, 2010 10:19 am 
Beginner
Beginner

Joined: Sun Jul 12, 2009 9:53 am
Posts: 21
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 ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.