Hi,
I'm executing several update statements like so:
Code:
for (Entity entity : entities) {
String queryString = "update Entity set property1 = :property1 " +
"where objectId = :objectId";
Query query = em.createQuery(queryString)
.setParameter("property1", someValue)
.setParameter("objectId", someId);
query.executeUpdate();
}
I want them to be batched, so single DB roundtrip is done.
I've set "hibernate.jdbc.batch_size" to "50".
I see no batching takes place.
Although, when I do:
Code:
for (Entity entity : entities) {
entity.setProperty1(someValue);
}
(entities are managed/persistent)
then, at the time of commit later, the batch happens.
Can I batch with the update statements?
I'm using Hibernate 4.3.1 via JPA API.