We are using container managed transaction . Application server JBOSS AS7 . I have enabled the below properties in hibernate configuration file
<property name="hibernate.connection.url">jdbc:mysql://localhost/test?rewriteBatchedStatements=true</property>
<property name="hibernate.jdbc.batch_size" value="20"/>
<property name="hibernate.order_inserts" value="true"/>
<property name="hibernate.order_updates" value="true"/>
<property name="hibernate.jdbc.batch_versioned_data" value="true"/>
And enabled the logging property as below
<logger category="org.hibernate.SQL">
<level name="TRACE"/>
</logger>
I am inserting 10 records to the database. In the hibernate.log , i could see 10 insert statements as below
org.hibernate.sql insert into test (name,value,date) values (?,?,?) org.hibernate.sql insert into test (name,value,date) values (?,?,?)
The batch insert didn't work