Kurru
Kurru

Reputation: 14321

Upgrading to hibernate 6: Encountered deprecated setting [javax.persistence.lock.timeout], use [jakarta.persistence.lock.timeout] instead

I am trying to upgrade to Hibernate 6, but this causes a huge amount of log spam. For every query with my database I get a warning in my console logs:

 WARN deprecation:44 - HHH90000021: 
 Encountered deprecated setting [javax.persistence.lock.timeout], use [jakarta.persistence.lock.timeout] instead

Our code base does not reference javax.persistence.lock.timeout and setting the jakarta property into the peristence.xml file does nothing.

This issue doesn't seem to be documented on the internet, I could only find a single reference to this in a hibernate bug report team, but there are no details.

If its relevant, we are connecting to Postgres on AWS RDS, via the C3P0 connection pool.

This warning continues to appear after removing C3P0 from the server so I don't think this default is coming from there.

Should I just suppress this log source in my log properties file or are there alternatives others are following?

Upvotes: 6

Views: 5132

Answers (2)

MartinBG
MartinBG

Reputation: 1648

According to HHH-15768 it is going to be fixed in Hibernate 6.1.7.

A temporary workaround is to set the property explicitly (accepted modes are defined here):

spring.jpa.properties.jakarta.persistence.sharedCache.mode=ENABLE_SELECTIVE

More on the problem and the workaround - here

Upvotes: 3

Sergiy
Sergiy

Reputation: 2041

I also experienced the same issue. And it seems not to be fixed yet(in 6.0.1).

At least I see in https://github.com/hibernate/hibernate-orm/blob/c18e611ed6786fd62a6bf2d17c39589c2452fe35/hibernate-core/src/main/java/org/hibernate/internal/FastSessionServices.java that old (and deprecated) javax.* properties are still set and then logged by LegacySpecHelper:

p.putIfAbsent( AvailableSettings.FLUSH_MODE, FlushMode.AUTO.name() );
p.putIfAbsent( JPA_LOCK_SCOPE, PessimisticLockScope.EXTENDED.name() );
p.putIfAbsent( JAKARTA_LOCK_SCOPE, PessimisticLockScope.EXTENDED.name() );
p.putIfAbsent( JPA_LOCK_TIMEOUT, LockOptions.WAIT_FOREVER );

Upvotes: 2

Related Questions