-->
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: Identifier - manual assigment
PostPosted: Thu May 28, 2009 9:45 am 
Newbie

Joined: Mon Jun 09, 2008 3:36 am
Posts: 4
Hello,

In my domain classes i have defined:
@SequenceGenerator(name = "seq_sy", sequenceName = "seq_syt", allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seq_sy").
()

Under some circumstance I would like manualy assign identifier.
Is possible disable on runtime SequenceGenerator or another way to achieve my goal ?


regard
EN


Top
 Profile  
 
 Post subject: Re: Identifier - manual assigment
PostPosted: Fri May 29, 2009 1:31 pm 
Newbie

Joined: Tue Nov 15, 2005 10:38 am
Posts: 4
Yes, it would be nice to know more about possibilities in this area. It appears that saveOrUpdate() always coins a new ID when it is doing an insert, and always does an update when it is not coining a new ID. We would also, sometimes, like to maunally coin the ID and then have Hibernate do the insert. Our current approach is to disable the generator and do all the ID coining ourselves. If that's the only option...


Top
 Profile  
 
 Post subject: Re: Identifier - manual assigment
PostPosted: Fri May 29, 2009 3:51 pm 
Newbie

Joined: Mon Jun 09, 2008 3:36 am
Posts: 4
bontempi wrote:
Our current approach is to disable the generator and do all the ID coining ourselves. If that's the only option...


How can I disable generator, I would mention that I can't change domain classes (annotation) ?

regard
EN


Top
 Profile  
 
 Post subject: Re: Identifier - manual assigment
PostPosted: Fri May 29, 2009 3:53 pm 
Newbie

Joined: Tue Nov 15, 2005 10:38 am
Posts: 4
Sorry, I meant disable the generator in the entity definition. Not programmatically.


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.