Search code examples
javahibernatejpauuiduuidgenerator

Using the new type() for UUIDGenerator instead of strategy?


According to the documentation, the following usage is deprecated:

@GenericGenerator(
            name = "UUID",
            strategy = "org.hibernate.id.UUIDGenerator"
    )

One shall use the new type()! But how can I transform my above statement to do the same with the type()? Just providing the hibernate UUIDGenerator doesn't work.


Solution

  • As the two comments above suggest, type is now of type class. Thus the fix is simple:

    @GenericGenerator(
                name = "UUID",
                type = org.hibernate.id.uuid.UuidGenerator.class
        )