[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-2716) Session.replicate failure with identity column

Yves Martin (JIRA) noreply at atlassian.com
Tue Jul 10 10:38:52 EDT 2007


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_27431 ] 

Yves Martin commented on HHH-2716:
----------------------------------

I have located where this issue may be fixed org/hibernate/event/def/DefaultReplicateEventListener.java 

final boolean regenerate = persister.isIdentifierAssignedByInsert(); // prefer re-generation of identity!
final EntityKey key = regenerate ? null : new EntityKey( id, persister, source.getEntityMode() );

According to discussions in http://forum.hibernate.org/viewtopic.php?p=2358517#2358517 and in devel mailing list http://www.mail-archive.com/hibernate-devel@lists.sourceforge.net/msg05230.html
I understand why regeneration is forced in case of Hibernate is not responsible for the identifier generation.

My proposal is "simple": add a "Dialect.supportsInsertIdentityValue" boolean 
and decide to "regenerate" or not according to this flag and persister.isIdentifierAssignedByInsert() value.


> Session.replicate failure with identity column
> ----------------------------------------------
>
>                 Key: HHH-2716
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2716
>             Project: Hibernate3
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.2
>         Environment: Java 1.5, MySQL 5.0.27 and Hibernate Annotations 3.2.1.GA
>            Reporter: Yves Martin
>
> I'm trying to use replicate:
> http://www.hibernate.org/hib_docs/reference/en/html/objectstate.html#objectstate-replicating
> The column "@version" is replicated properly (same value in second db) but the column "@Id @GeneratedValue" contains a new value from the db2 sequence.
> In fact the insert statement generated by the replicate method does not include the "id" column.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list