users@glassfish.java.net

Re: Problem with insert

From: <glassfish_at_javadesktop.org>
Date: Wed, 18 Jun 2008 07:39:16 PDT

Hello,

I can't say whats going wrong for sure without the SQL that is being used. What is certain is that a value is being inserted into a column marked GENERATED ALWAYS. Since you are probably using OpenJPA, it might be that they do not support GenerationType.IDENTITY on DB2 (i'm guessing from the error message) but I really don't know. You might try EclipseLink which does support it, and provide the SQL if you still get a problem.

As for the code, em.merge(dog) will attempt to do an insert into both the Animal and Dog tables since you have joined table inheritance defined. A Dog entity will always have a row in both the Animal and Dog tables.

Best Regards,
Chris
[Message sent by forum member 'chris_delahunt' (chris_delahunt)]

http://forums.java.net/jive/thread.jspa?messageID=281036