-->
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: Session.replicate() problem with custom ID
PostPosted: Mon Nov 28, 2005 7:56 pm 
Newbie

Joined: Sat Oct 29, 2005 2:02 pm
Posts: 1
Hi. I'm trying to create some migration code and use Session.replicate(). So I simply make new object, set specific ID (the mapping is <generator class="native"/>) and call replicate() on it. I have such debug trace:

Quote:
Role object before replication - name: Users ;id: 25

Hibernate: select jbp_rid from jbp_roles where jbp_rid =?
Hibernate: insert into jbp_roles (jbp_name, jbp_displayname, jbp_rid) values (?, ?, null)
Hibernate: call identity()

Role object after replication - name: Users ;id: 1



with OVERWRITE mode on every replicate() call it simply set ID value to "1". So doing replicate() on object in HSQLDB always overwrite first table row. In MySQL it simply generates id's starting from 1....
I tried EXCEPTION mode and it behaves like save() - simply generate id's starging from 1.... and nothing is thrown...

Simplest workaround is to turn off id's generation and use save().

Am I missing something?

Maybe replicate ehaviour is so vendor specific that it should be avoided?

Anyone found Session.replicate() functional for custom assigned IDs?

_________________
Boleslaw Dawidowicz


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.