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: @GeneratedValue for non-@Id fields (EJB3)
PostPosted: Sun Oct 26, 2008 12:42 pm 
Newbie

Joined: Sun Oct 26, 2008 12:22 pm
Posts: 1
Hello all,

I have to deal with an existing Oracle schema, which contains the table with 2 different unique keys. One of them is record# and should be generated from the sequence, another one is string entity Id, and I want to use it as a primary id.
Is this possible in JPA - to make it generate record # from the sequence when field is not marked as @Id? I tried, but it didn't work.
Maybe it's possible to do this manually in @PrePersist method? But how do I access Oracle sequence from the entity's member method? (The preferrable way is to use JPA only, using native SQL also may be acceptable)

Thank you


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.