Welcome to the Hibernate community newsletter in which we share blog posts, forum, and StackOverflow questions that are especially relevant to our users.
The pick of this edition is this article by Heap’s Engineering blog which demonstrates the benefits of using batch updates even for reducing database index overhead.
Hibernate 5.2.10 comes with a very handy connection management optimization for RESOURCE_LOCAL transactions.
If you don’t use JTA and you disabled auto-commit at the connection pool level, then it’s worth setting the
hibernate.connection.provider_disables_autocommit configuration property as well.
When using Oracle, the fastest way to access a database record is to use the
ROWID is suitable for your application, then you can
annotate your entities with the
and Hibernate will use the
ROWID pseudocoolumn for UPDATE statements.
The best way to manage a database schema is to use incremental update scripts, and a tool like Flyway. Even in this case, you can still benefit from the hbm2ddl tool to validate the entity mappings. Check out how you can deal with schema mismatch exceptions, especially for non-trivial mappings.
You can use Hibernate statistics to log query execution time.
However, in reality, many enterprise application are better off using a JDBC
which, not only it allows you to log JDBC statements along with their parameters,
but you can even detect N+1 query issues automatically during testing.
Jakub Kubryński has a very good presentation about JPA common pitfalls and how you should handle them effectively.