Hibernate warning - cant' seem to find offending code / component

57 views
Skip to first unread message

George Callhoun

unread,
May 17, 2024, 1:45:43 PM5/17/24
to WildFly
I get this WARN on startup in my server.log.

07:40:24,477 INFO  [org.hibernate.Version] (ServerService Thread Pool -- 81) HHH000412: Hibernate Core {5.3.28.Final}

07:40:29,490 WARN  [org.hibernate.orm.deprecation] (ServerService Thread Pool -- 81) HHH90000014: Found use of deprecated [org.hibernate.id.SequenceGenerator] sequence-based id generator; use org.hibernate.id.enhanced.SequenceStyleGenerator instead.  See Hibernate Domain Model Mapping Guide for details.

So fix the deprecated usage right?  Only I can't find it anywhere.

Currently on WildFly 26 but the warning has been with us since Wildfly 20 and possibly earlier.  My source code has no references to the deprecated class.  The closest thing I see to it is in a persistence.xml file containing:
    <property name="hibernate.id.new_generator_mappings" value="false" />

Any ideas where I might hunt and find this usage?  Is Wildfly the culprit (does Wildfly use hibernate?) or should I be looking at other components?

Scott Marlow

unread,
May 17, 2024, 2:36:06 PM5/17/24
to George Callhoun, WildFly
On Fri, May 17, 2024 at 1:45 PM George Callhoun <gcall...@gmail.com> wrote:
I get this WARN on startup in my server.log.

07:40:24,477 INFO  [org.hibernate.Version] (ServerService Thread Pool -- 81) HHH000412: Hibernate Core {5.3.28.Final}

07:40:29,490 WARN  [org.hibernate.orm.deprecation] (ServerService Thread Pool -- 81) HHH90000014: Found use of deprecated [org.hibernate.id.SequenceGenerator] sequence-based id generator; use org.hibernate.id.enhanced.SequenceStyleGenerator instead.  See Hibernate Domain Model Mapping Guide for details.

In case it helps, the warning seems to be logged in https://github.com/hibernate/hibernate-orm/blob/69ffd8ec1cf3a714d8a9649347b377247587d4b7/hibernate-core/src/main/java/org/hibernate/id/SequenceGenerator.java#L87 (from the Hibernate ORM 5.3 branch) which matches the information shown in the above warning. 

I'm not sure why that warning doesn't get the entity class name which I see other code that calls that method getting via "config.getProperty( IdentifierGenerator.ENTITY_NAME )". Including the entity class name in the warning would have been helpful to understand which of your application classes to look at updating to use org.hibernate.id.enhanced.SequenceStyleGenerator.





So fix the deprecated usage right?  Only I can't find it anywhere.

Currently on WildFly 26 but the warning has been with us since Wildfly 20 and possibly earlier.  My source code has no references to the deprecated class.  The closest thing I see to it is in a persistence.xml file containing:
    <property name="hibernate.id.new_generator_mappings" value="false" />

Any ideas where I might hunt and find this usage?  Is Wildfly the culprit (does Wildfly use hibernate?) or should I be looking at other components?

WildFly does include Hibernate ORM.

Does your persistence.xml specify the "hibernate.id.new_generator_mappings"?  That should default to true but I wonder if your setting it to false?  Don't just remove that property though as that is not the only change needed if you did set it to false.
 

--
You received this message because you are subscribed to the Google Groups "WildFly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/f6cf56a4-3d94-4a21-bb3f-d0e63a1a5d72n%40googlegroups.com.

Scott Marlow

unread,
May 17, 2024, 2:37:39 PM5/17/24
to George Callhoun, WildFly
I forgot to mention https://stackoverflow.com/questions/39861098/replace-sequencegenerator-since-its-deprecated which gives an example of using org.hibernate.id.enhanced.SequenceStyleGenerator.

George Callhoun

unread,
May 20, 2024, 2:13:58 PM5/20/24
to WildFly
I agree, more specificity in the WARN message would have been nice.  No idea what is causing it.
I did try what you said to change  hibernate.id.new_generator_mappings" value="false"  TO   hibernate.id.new_generator_mappings" value="true".   Still get the WARN messages.

John Saccoccio

unread,
May 21, 2024, 11:25:33 AM5/21/24
to WildFly
I'm guessing you're using a DBMS sequence and not a custom generator. 
Hibernate is deprecating legacy API use and pushing use of JPA APIs.  (Criteria API deprecation is going to kill us!)
Not sure if this is relevant or not, but your app is in Wildfly, why not use the JPA API?  
    @SequenceGenerator(name = "SEQ_ENTITY", schema = "HR", sequenceName = "SEQ_ENTITY")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_ENTITY")
    @Id
    private Long EntityId;

Reply all
Reply to author
Forward
0 new messages