-->
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.  [ 4 posts ] 
Author Message
 Post subject: get pojo primary key
PostPosted: Mon Jun 04, 2007 12:38 pm 
Beginner
Beginner

Joined: Thu Jan 20, 2005 1:45 pm
Posts: 49
hi all
I need to get dynamically the value of the primary key of some pojos.
The problem is that i do not know the name of the primary key (or I need a generic methods for doing that)
I wonder if exist i dynamic way of getting it.
regards


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 05, 2007 8:46 am 
Beginner
Beginner

Joined: Sat May 12, 2007 2:55 am
Posts: 24
you can use <id> for getting the primary key


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 05, 2007 12:03 pm 
Senior
Senior

Joined: Sat Apr 21, 2007 11:01 pm
Posts: 144
I surgest you make a Domain object that extends all of your data objects (pojos) and make a getPK() method in each of the Domain objects that calls the correct method in your pojo for the PK. you will obviously have to identiy this method by hand for each obecjt. the advantage of doing it this way is all the effort is done before run time so will be much faster than any magical way of reflecting the PK or something.

_________________
Everytime you get an answer to your question without giving credit; god kills a kitten. :(


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 05, 2007 2:16 pm 
Beginner
Beginner

Joined: Thu Jan 20, 2005 1:45 pm
Posts: 49
i solved with classMetadata.Regards


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

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.