Upon upgrading to Hibernate 5.6.0.Final, I found that org.hibernate.annotations.Type is now deprecated. I use this annotation in many of my entities, including places where I leverage Hibernate's own NumericBooleanType:

 @Type(type = "org.hibernate.type.NumericBooleanType") private Boolean debug = false; 

I've searched Hibernate docs (migration guides - of which the 6.0 version gives me a 404 from ), Javadocs, forums, and the web to find a replacement, to no avail.

Does anyone know what I can do now in Hibernate 5.6.0 to prepare my code using the Type annotation for the transition to Hibernate 6?

2

3 Answers

For those who are wondering what's the alternative approach with hibernate 6, you have to change this from:

@Type(type = "org.hibernate.type.NumericBooleanType") private Boolean debug = false; 

to this:

@Convert(converter = org.hibernate.type.NumericBooleanConverter.class) private Boolean debug = false; 

Refer -

Edit: the change was reverted in 5.6.3. There should no longer be any deprecation warnings.


There is nothing you can do until you upgrade to 6.0, unless sufficient people complain on this issue that they revert the change in 5.6.1 or something.

Hibernate have made the unusual decision to deprecate these annotations early, before there's any replacement.

I don't know why. The only thing it will do is make people suppress the warnings, and then forget about it when 6.0 is released and never make the change.

8

That's quite a logical leap that just happens to fit with your preconceived opinion. "discouraged from using" in no way implies "there is a current replacement

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.