-->
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.  [ 4 posts ] 
Author Message
 Post subject: hibernate.jdbc.batch_versioned_data set to true by default
PostPosted: Tue Jan 26, 2016 3:10 am 
Beginner
Beginner

Joined: Thu Nov 26, 2015 11:40 am
Posts: 33
I am trying out the code at link http://vladmihalcea.com/how-to-batch-insert-and-update-statements-with-hibernate/ with 5.0.4.

I have just set the below properties
Code:
properties.put("hibernate.jdbc.batch_size","15");
properties.put("hibernate.order_inserts", "true");
properties.put("hibernate.order_updates", "true");


and I still see the INSERT and the UPDATE statements are properly batched even without setting the below property

properties.put("hibernate.jdbc.batch_versioned_data", "true");

The output I see is:

Code:
insert into BatchPost (title, version, id) values (?, ?, ?)"], Params:[(1=Post1,2=0,3=326),(1=Post2,2=0,3=329)]
insert into BatchComment (post_id, review, version, id) values (?, ?, ?, ?)"], Params:[(1=326,2=Post11,3=0,4=327),(1=326,2=Post12,3=0,4=328),(1=329,2=Post21,3=0,4=330),(1=329,2=Post22,3=0,4=331)]

select post0_.id as id1_1_0_, comments1_.id as id1_0_1_, post0_.title as title2_1_0_, post0_.version as version3_1_0_, comments1_.post_id as post_id4_0_1_, comments1_.review as review2_0_1_, comments1_.version as version3_0_1_, comments1_.post_id as post_id4_0_0__, comments1_.id as id1_0_0__ from BatchPost post0_ inner join BatchComment comments1_ on post0_.id=comments1_.post_id"], Params:[()]
update BatchComment set post_id=?, review=?, version=? where id=? and version=?"], Params:[(1=326,2=Post11ModifiedModified,3=1,4=327,5=0),(1=326,2=Post12ModifiedModified,3=1,4=328,5=0),(1=329,2=Post21ModifiedModified,3=1,4=330,5=0),(1=329,2=Post22ModifiedModified,3=1,4=331,5=0)]
update BatchPost set title=?, version=? where id=? and version=?"], Params:[(1=Post1ModifiedModified,2=1,3=326,4=0),(1=Post2ModifiedModified,2=1,3=329,4=0)]


I am wondering, shouldn't this value should be treated as false by default as per hibernate documentation.


Top
 Profile  
 
 Post subject: Re: hibernate.jdbc.batch_versioned_data set to true by default
PostPosted: Tue Jan 26, 2016 4:25 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
According to the migration guide:

Quote:
hibernate.jdbc.batch_versioned_data default value is now true; Oracle dialects set this property to false, except for Oracle12cDialect


Top
 Profile  
 
 Post subject: Re: hibernate.jdbc.batch_versioned_data set to true by default
PostPosted: Tue Jan 26, 2016 7:05 am 
Beginner
Beginner

Joined: Thu Nov 26, 2015 11:40 am
Posts: 33
Looks like the userGuide http://docs.jboss.org/hibernate/orm/5.0/userGuide/en-US/html_single/ needs to be updated. It still says:

Quote:
hibernate.jdbc.batch_versioned_data - Some JDBC drivers return incorrect row counts when a batch is executed. If your JDBC driver falls into this category this setting should be set to false. Otherwise it is safe to enable this which will allow Hibernate to still batch the DML for versioned entities and still use the returned row counts for optimitic lock checks. Currently defaults to false to be safe


I have created a JIRA to correct this @ https://hibernate.atlassian.net/browse/HHH-10479


Top
 Profile  
 
 Post subject: Re: hibernate.jdbc.batch_versioned_data set to true by default
PostPosted: Tue Jan 26, 2016 7:49 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
Thanks, I'll take care of it.


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