Reputation: 71
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(--,--,--)
------
-------
}
Upvotes: 0
Views: 604
Reputation: 2183
To support both oracle and mysql, use AUTO generated type As:
@GeneratedValue(strategy=GenerationType.AUTO)
Upvotes: 0