Replace @SequenceGenerator since its deprecated

六眼飞鱼酱① 提交于 2019-11-28 07:22:57

According to the warning message and Hibernate documentation (Hibernate deprecated list) you should use SequenceStyleGenerator. Or better use @GenericGenerator and specify generator strategy.

Here is a typical example of usage:
@GenericGenerator(
        name = "wikiSequenceGenerator",
        strategy = "org.hibernate.id.enhanced.SequenceStyleGenerator",
        parameters = {
                @Parameter(name = "sequence_name", value = "WIKI_SEQUENCE"),
                @Parameter(name = "initial_value", value = "1000"),
                @Parameter(name = "increment_size", value = "1")
        }
)
@Id
@GeneratedValue(generator = "wikiSequenceGenerator")
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!