Re: Issues with GeneratedValue and SequenceGenerator

2011-04-12 Thread realdepp
I forgot to add it here - I opened a bug report: https://issues.apache.org/jira/browse/OPENJPA-1977 -- View this message in context: http://openjpa.208410.n2.nabble.com/Issues-with-GeneratedValue-and-SequenceGenerator-tp6244055p6265927.html Sent from the OpenJPA Users mailing list archive at Nab

Re: Issues with GeneratedValue and SequenceGenerator

2011-04-12 Thread Jeremy Bauer
I agree. The OpenJPA documentation is confusing/contradictory. 1.2. Final Entity classes may not be final. No method of an entity class can be final. *Note* OpenJPA supports final classes and final methods. I wonder if the distinction is "Entity" vs. a plain old class? Either way, I think t

Re: Issues with GeneratedValue and SequenceGenerator

2011-04-11 Thread Rick Curtis
1.2. Final Entity classes may not be final. No method of an entity class can be final. Note OpenJPA supports final classes and final methods. Confusing? Perhaps. It seems pretty clear that we don't support final Entities or final Entity methods. I'm not sure what the "Note" is referring to thoug

Re: Issues with GeneratedValue and SequenceGenerator

2011-04-11 Thread realdepp
I'm not sure about that - the final modifier seems to be the cause for the problem. The JPA spec sais: "Entity classes may not be final. No method of an entity class can be final." BUT the OpenJPA docs say: "OpenJPA supports final classes and final methods." http://openjpa.apache.org/builds/2.1.0

Re: Issues with GeneratedValue and SequenceGenerator

2011-04-07 Thread realdepp
I think I got it: When I mark the getter and the setter for the id as "final", the error occurs. Without final it works fine. -- View this message in context: http://openjpa.208410.n2.nabble.com/Issues-with-GeneratedValue-and-SequenceGenerator-tp6244055p6249036.html Sent from the OpenJPA Users m

Re: Issues with GeneratedValue and SequenceGenerator

2011-04-06 Thread Michael Dick
Well, I was able to reproduce if I do the following 1. Create the database tables. 2. Run the PCEnhancer with BaseEntity and MyEntity in the persistence.xml 3. Remove BaseEntity from persistence.xml 4. Persist a new instance of MyEntity. I've only reproduced with IDENTITY, but it should be simila

Re: Issues with GeneratedValue and SequenceGenerator

2011-04-06 Thread realdepp
Yes, MyBase is in persistence.xml. -- View this message in context: http://openjpa.208410.n2.nabble.com/Issues-with-GeneratedValue-and-SequenceGenerator-tp6244055p6247366.html Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Issues with GeneratedValue and SequenceGenerator

2011-04-06 Thread realdepp
I don't know whats happening here - I tested with MySQL 5.1.31 and it worked. Then I switched back to MySQL 4.1.22 and it worked, too. So I'm not able to reproduce the error for now - but I have no idea why. -- View this message in context: http://openjpa.208410.n2.nabble.com/Issues-with-Generat

Re: Issues with GeneratedValue and SequenceGenerator

2011-04-06 Thread Michael Dick
Is the MyBase class listed in persistence.xml? -mike On Wed, Apr 6, 2011 at 1:54 PM, realdepp wrote: > MySQL version is 4.1.22 > Connector version is 5.1.8, JDBC version is documented as 4.0 > > > -- > View this message in context: > http://openjpa.208410.n2.nabble.com/Issues-with-GeneratedValu

Re: Issues with GeneratedValue and SequenceGenerator

2011-04-06 Thread realdepp
MySQL version is 4.1.22 Connector version is 5.1.8, JDBC version is documented as 4.0 -- View this message in context: http://openjpa.208410.n2.nabble.com/Issues-with-GeneratedValue-and-SequenceGenerator-tp6244055p6247210.html Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: Issues with GeneratedValue and SequenceGenerator

2011-04-06 Thread Jeremy Bauer
IIRC, the identity value should be getting returned by the JDBC driver as a result of the insert. OpenJPA then populates the entity with that value. What version of MySQL DB and JDBC driver are you using? -Jeremy On Wed, Apr 6, 2011 at 10:16 AM, realdepp wrote: > Thanks, but that didn't solve

Re: Issues with GeneratedValue and SequenceGenerator

2011-04-06 Thread realdepp
Thanks, but that didn't solve the problem. EntityManager.refresh() has no effect, like expected. I'm not enhancing with an eclipse tool, I'm calling the java program via ant:

Re: Issues with GeneratedValue and SequenceGenerator

2011-04-06 Thread Michael Dick
Rick's right, my memory was faulty. I think in the earlier versions of OpenJPA a refresh was required, but when I ran with a 2.1.1 snapshot this morning I didn't have to call refresh. Thanks for keeping me honest Rick.. -mike On Wed, Apr 6, 2011 at 9:45 AM, Rick Curtis wrote: > I'm guessing th

Re: Issues with GeneratedValue and SequenceGenerator

2011-04-06 Thread Rick Curtis
I'm guessing that this might have to do with your enhancement method? If you are using the eclipse plugin... that is most likely the problem. See OPENJPA-1879[1] for details. [1] https://issues.apache.org/jira/browse/OPENJPA-1879 Thanks, Rick On Tue, Apr 5, 2011 at 5:36 PM, realdepp wrote: > H

Re: Issues with GeneratedValue and SequenceGenerator

2011-04-05 Thread Michael Dick
When you use GenerationType.IDENTITY or GenerationType.SEQUENCE the ID values aren't known until the row is inserted. OpenJPA does not automatically refresh this information, but you can obtain it if you use the EntityManager.refresh() method. Regarding intialValues, did OpenJPA create the sequenc