multiple database support for same JPA classs

喜欢而已 提交于 2019-11-28 14:34:13
JB Nizet

The AUTO strategy should work on Oracle as well. The difference with MySQL is that it will use a sequence instead of relying on an auto_increment ID.

You can even control the sequence name per entity if desired: see Hibernate sequence on oracle, @GeneratedValue(strategy = GenerationType.AUTO).

@Id
    @SequenceGenerator(name="admin_seq", sequenceName="unique_id")
    @GeneratedValue(strategy=GenerationType.AUTO, generator="admin_seq")
    private Long id

worked for me , thanks for all your answers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!