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?