Hello,
I have a requirement to build the persistence layer to work with any database i.e cross databases.
I have configured @ID for with below Generator.
Code:
@ID
@GenericGenerator(name="pid-ul", strategy="[b]native[/b]",
parameters = {
@Parameter(name="sequence", value="ul_seq_id")
}
)
@Column(name = "USER_LICENSE_ID", unique = true, nullable = false, precision = 22, scale = 0)
@GeneratedValue(generator="pid-ul")
public long getUserLicenseId() {
return this.userLicenseId;
}
I have tested above in mysql, it was working fine. when I have tested with Oracle the id value is null.Why GenericGenerator is not using the sequence available in Oracle database to generate the next sequence value?
My understanding of the above GenericGenerator configuration is
If am using mysql database it should use the database identity generation
If am using Oracle database it shoule use the provided sequence name("ul_seq_id") provided as part of parameters.
any help in this regards will be helpful.
best wishes
srini jalagam
Code: