Milosz, I have tried "@GeneratedValue(strategy=GenerationType.AUTO)", it works fine for oracle but doesn't work for Derby.
Regards, Yu Wang On Sat, Jun 13, 2009 at 7:19 PM, Miłosz Tylenda<mtyle...@o2.pl> wrote: > 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 >> >