-->
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: hibernate.order_inserts property in Hibernate4 vs Hibernate5
PostPosted: Sun Jun 11, 2017 11:13 am 
Newbie

Joined: Sun Jun 11, 2017 10:54 am
Posts: 1
Hi,
I'm upgrading my application from Hibernate(4.3.11) to Hibernate (5.2.10). With Hibernate 4, I was having hibernate.order_inserts=true and hibernate.order_updates=true in my hibernate properties. But since now i upgraded to Hibernate5 facing the problem following problem :-

Code:
java.sql.BatchUpdateException: The INSERT statement conflicted with the FOREIGN KEY constraint "RP07_DTYPE_FK". The conflict occurred in database "MyDB", table "na.RP06_DTYPE", column 'ID'.
     com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeBatch(SQLServerPreparedStatement.java:1178)
     com.zaxxer.hikari.pool.ProxyStatement.executeBatch(ProxyStatement.java:128)
     com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeBatch(HikariProxyPreparedStatement.java)
     org.hibernate.engine.jdbc.batch.internal.BatchingBatch.performExecution(BatchingBatch.java:111)
     org.hibernate.engine.jdbc.batch.internal.BatchingBatch.doExecuteBatch(BatchingBatch.java:97)
     org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.execute(AbstractBatchImpl.java:147)


When i set hibernate SQL level to debug then found out that now my INSERT commands are batched on the basis of Entity Type, So it first tries to execute the INSERT COMMANDS for inverse side table so it fails with the above error.

But i set hibernate properties hibernate.order_inserts and hibernate.order_updates to false then there is no exception like this.

I also tried to go through the Hibernate 5 documentation, Is there anything changed for these configuration, but unfortunately i find nothing.

Can you please help me to understand why is this behaviour ?

Note :- My entities are in One to Many bidirectional relationship.


Top
 Profile  
 
 Post subject: Re: hibernate.order_inserts property in Hibernate4 vs Hibernate5
PostPosted: Mon Jun 12, 2017 2:14 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
You should try to replicate it using our test case templates, and then open a Jira issue and attach the unit tests to see your mappings.


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.