tags:

views:

104

answers:

1

Hello, Is possible to change hibernate.jdbc.batch_size programmatically? I understand hibernate.jdbc.batch_size is a application level parameter, wanted to know if i can use it specifically for certain HQL inserts and not others. I would change the code only for those HQL inserts

The big picture is that i need to introduce batch inserts to make the web application performant in some scenarios, but i do not want to jeopardize the normal inserts which work right now.

Any pointers would help

thanks Sameer

A: 

To my knowledge, you can't change the configuration settings of a SessionFactory at runtime (the settings are not exposed via the public API and are immutable).

In other words, I would use another SessionFactory (and set the hibernate.jdbc.batch_size property in the Configuration object used to build it) in the specific scenarios needing it.

Pascal Thivent
Thanks. This resonates with my understanding. I tested the application. Non bulk inserts work fine as before