Yu Wang,

Try using "@GeneratedValue(strategy=GenerationType.AUTO)". This should 
automatically pick up either IDENTITY or SEQUENCE depending on the database you 
are using.

Cheers,
Milosz 

> Hello,
> I found If I user derby, I need to use
> "@GeneratedValue(strategy=GenerationType.IDENTITY)" for ID field.
> And for oracle database, I need to use
> "@GeneratedValue(strategy=GenerationType.SEQUENCE)".
> 
> The question is if I want to use same entity classes to support both
> derby and oracle, how should I do?
> Do we have best practice for ID field value generation strategy for
> multiple databases supporting?
> 
> Regards,
> Yu Wang
> 

Reply via email to