-->
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.  [ 3 posts ] 
Author Message
 Post subject: Problem sequence not incremented on annotation composite key
PostPosted: Thu Mar 25, 2010 4:50 am 
Newbie

Joined: Wed Jan 13, 2010 10:28 am
Posts: 4
hi,

i hava a problem

i have a db oracle, and i have implemented jpa annotation and a composite key

my class :

class item which contains
Code:
@EmbeddedId
   protected PrimaryKeyId primaryKeyId;


class PrimaryKeyId
Code:
@Embeddable
public class PrimaryKeyId implements Serializable {

   /**
    *
    */
   private static final long serialVersionUID = 2868479904735001761L;

   @Column(length=2,name="key1")
   private String nkeyId1="01";
   
   @Column(name="key2")
   @GeneratedValue(strategy=GenerationType.SEQUENCE,generator="sequenceItem")
   @SequenceGenerator( name = "sequenceItem",sequenceName="SEQ_ITEM",allocationSize=1)
   private int nkeyId2;

with getter/setters...
in my db, oraclesqldevelopper say that the sequence has never been used...


it seems that the generated value is not call, in my db i have only one row with key "010", 0 for the nkeyId2 not incremented
if i save many item, there are all updated because the ids is not incremented...

do i need to implement something else?

thx


Top
 Profile  
 
 Post subject: Re: Problem sequence not incremented on annotation composite key
PostPosted: Thu Mar 25, 2010 5:27 am 
Newbie

Joined: Wed Jan 13, 2010 10:28 am
Posts: 4
review...

if i change with only one key, the sequence is well generated, so the problem comes from the composite key which not call the generator it seems..., any idea?


Top
 Profile  
 
 Post subject: Re: Problem sequence not incremented on annotation composite key
PostPosted: Thu Mar 25, 2010 6:19 am 
Expert
Expert

Joined: Wed Mar 03, 2004 6:35 am
Posts: 1240
Location: Lund, Sweden
Generators are not supported with composite keys. The application must assign its own values. See first paragraph below the note: http://docs.jboss.org/hibernate/stable/ ... ompositeid


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.