1
When making some queries in a view using JPA (2.1) with hibernate, I’m having this Warning. Though it’s working and it’s only one Warning, It bothers me a little bit.
WARN org.hibernate.Loader.Loader - HHH000444: Encountered request for Locking However dialect Reports that database prefers Locking be done in a Separate select (follow-on Locking); Results will be locked after initial query execute
This occurs in the following environment:
- JPA 2.1 / Hibernate 4.3.0.Final;
- Wildfly 8.0.0.Final;
- Oracle DB 10g;
Also, doing research on this Warning, I came up with a bug report for the Hibernate people who turned out to be rejected. In the bug, the problem also seems to occur in Oracle 11g.
How to correct or avoid this Warning?
Honestly, "create" a proper dialect to hide a Warning? And when the mistake actually happens? This then will never appear in LOG and hours and hours will be lost looking for an error that is no longer displayed.
– uaiHebert
I believe an error would not occur because the followOnLocking pattern is
false
. P/ o Oracle istrue
. Maybe I’ll miss a feature. This starts to occur after the update of Hibernate p/ version 4.2.0, where the dialect of Oracle8i that is the father of the dialects of 9i and 10g has changed the methoduseFollowOnLocking()
to returntrue
. However, the default, according to the documentation itself, isfalse
.– humungs
Therefore, everything indicates that it seems to be more an incorrect message than a problem. There is a discussion on the Hibernate forum about this.
– humungs
Again, what will happen when really a problem happens?
– uaiHebert
But what’s the problem that could happen?
– humungs
Encountered request for Locking However dialect Reports that database prefers Locking be done in a Separate select (follow-on Locking); Results will be locked after initial query execute
– uaiHebert
Imagine the day the default setting is not active in the database...
– uaiHebert
Searching a little further, I found that useFollowOnLocking is related to the use of pessimistic or optimistic lock. So if you’re going to use pessimitic Locking,
useFollowOnLocking = false
. If it is optimistic Locking thenuseFollowOnLocking = true
. It will depend on your project’s approach.– humungs
I’m sorry, but look what your solution proposes. Then the server performance goes to the ground because they are using something that should not and will not be warned in Warning.
– uaiHebert
What solution to the problem you suggest?
– humungs
Ignore log. 3 lines of a Warning does not affect anything.
– uaiHebert
It is not three lines. It is a line for each line returned in a query made by Hibernate search. So, if what is indexed with HS is a table with 5000 lines, it is 5000 warnings. Anyway, I posted an issue in the English OS on that case.
– humungs
You could change the type of Warning logged in via log4j. or Wish to determine another file so that any Hibernate log would be saved. Thousands of other options that would not 'mask' when the real problem happens.
– uaiHebert
Updating... Really this logging shouldn’t happen second reply in the SO and a new bug report in Hibernate was opened.
– humungs