简体   繁体   中英

Sequence generation for Oracle and MYSQL with same code base with Hibernate persistence provider

in my project we are using Oracle and we want to give support for MYSQL also. In POJOs/Domains we used sequence generator annotation. Oracle have sequence support but MYSQL don't have. How to handle with same code base? can any help me here out please.

NOTE: We dont want to change out existing code using IDENTITY annotation @GeneratedValue(strategy=GenerationType.IDENTITY)

Ex:
Class POJO{
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqgenerator")
@SequenceGenerator(--,--,--)
------
-------
}

要同时支持oracle和mysql,请使用AUTO生成的类型为:

@GeneratedValue(strategy=GenerationType.AUTO)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM