Re: ID field auto generation issue for multiple databases supporting

2009-06-18 Thread wang yu
Hi Milosz, Yes, you're right. And I have checked the source code, the AUTO is total identical with TABLE in OpenJPA. Thank you for your patient help! Regards, Yu Wang On Wed, Jun 17, 2009 at 6:02 PM, Miłosz Tylenda wrote: > Hi Yu Wang, > > The error message seems to say "Attempt to modify an id

Re: ID field auto generation issue for multiple databases supporting

2009-06-17 Thread Miłosz Tylenda
Hi Yu Wang, The error message seems to say "Attempt to modify an identity column 'ID'". Probably Derby does not allow you to insert a value to an identity column. I suspect you have created the table when you had GenerationType.IDENTITY in your entity. The table has been created with an identit

Re: ID field auto generation issue for multiple databases supporting

2009-06-17 Thread wang yu
Hello Milosz, I found OpenJpa created table OPENJPA_SEQUENCE_TABLE automatically in the runtime, following is a fragment of my log file: 44048 xxx TRACE [Persistence-thread-0] openjpa.jdbc.SQL - executing prepstmnt 25906379 SELECT SEQUENCE_VALUE FROM xxx.OPENJPA_SEQUENCE_TABLE WHERE ID = ? FOR

Re: ID field auto generation issue for multiple databases supporting

2009-06-17 Thread Miłosz Tylenda
Yu Wang, Can we see your entity with "@GeneratedValue(strategy=GenerationType.AUTO)" and the stack trace you are receiving with Derby? Greetings, Milosz > Milosz, > > I have tried "@GeneratedValue(strategy=GenerationType.AUTO)", it works > fine for oracle but doesn't work for Derby. > > Rega

Re: ID field auto generation issue for multiple databases supporting

2009-06-14 Thread wang yu
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 wrote: > Yu Wang, > > Try using "@GeneratedValue(strategy=GenerationType.AUTO)". This should > automaticall

Re: ID field auto generation issue for multiple databases supporting

2009-06-13 Thread Miłosz Tylenda
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 auto generation issue for multiple databases supporting

2009-06-11 Thread wang yu
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 sho