Search code examples
javahibernatedeprecated

What should I replace the hibernate deprecated @TypeDef and @Type annotations by?


I've just upgraded the version I use for Hibernate to 5.6.1 and it seems it's now deprecating some Type-related annotations:

@TypeDef(name = "json", typeClass = JsonBinaryType::class)


@Type(type = "json")

I found no documentation as to what to do except that

6.0 will introduce a new series of type-safe annotations to serve the same purpose

Our quality guidelines forces us to try and solve every warning and as such I would like to replace these annotations by a non deprecated use.


Solution

  • It seems there is no replacement until Hibernate 6. Type and also TypeDef was marked as deprecated to mark it as removed in version 6, but so far not replacement exists. The ideology here is that deprecated does not indicate that already a new version exists, which might be not an intuitive meaning for most developers.

    This was reverted now in the current 5.6.3-Final version series.