-->
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.  [ 2 posts ] 
Author Message
 Post subject: id field is updated after insert
PostPosted: Sat Jun 24, 2017 9:19 am 
Newbie

Joined: Sat Jun 24, 2017 9:04 am
Posts: 1
I am upgrading a project from hibernate 3.3.2GA to 4.3.11.Final and ran into this issue where the native generated id is getting updated after the insert. This was not happening in the 3.3.2 version. I tried debugging but don't see the setter getting called again. We are using hbm files for mapping and there's no update=false option like there is with the JPA annotations.

Any ideas what could be causing this?

Code:
Hibernate: insert into XXX.MEMBER (ID, UOM_ID, SIZ_TX) values (default, ?, ?)
2017-06-24 08:54:17,637 TRACE - binding parameter [1] as [BIGINT] - [3301]
2017-06-24 08:54:17,637 TRACE - binding parameter [2] as [VARCHAR] - [size 1]

Hibernate: insert into XXX.MEMBER(ID, UOM_ID, SIZ_TX) values (default, ?, ?)
2017-06-24 08:54:40,671 TRACE - binding parameter [1] as [BIGINT] - [3301]
2017-06-24 08:54:40,672 TRACE - binding parameter [2] as [VARCHAR] - [size 2]

Hibernate: update XXX.MEMBER set ID=? where ID=?
2017-06-24 08:54:50,410 TRACE - binding parameter [1] as [INTEGER] - [0]
2017-06-24 08:54:50,410 TRACE - binding parameter [2] as [BIGINT] - [2202]

Hibernate: update XXX.MEMBER set ID=? where ID=?
2017-06-24 08:54:50,410 TRACE - binding parameter [1] as [INTEGER] - [1]
2017-06-24 08:54:50,410 TRACE - binding parameter [2] as [BIGINT] - [2203]


Top
 Profile  
 
 Post subject: Re: id field is updated after insert
PostPosted: Sat Jun 24, 2017 10:01 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1630
Location: Romania
If you mapped the identifier properly, that can never happen.

What's interesting is that the UPDATE only contains the ID< but In Hibernate all columns are used during the update.

Try to debug it and see what's causing the issue. Since you are upgrading, you might consider upgrading to 5.2 as well and port the HBM mappings to annotations. It might be that HBM mappings will be dropped in future in favor of JPA XML extensions.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.