users@glassfish.java.net

Re: Question on JPA generating the wrong database commands

From: <glassfish_at_javadesktop.org>
Date: Tue, 28 Aug 2007 14:20:55 PDT

There are two entities: Hardware and Software. The Hardware entity maintains a one to many relationship with Software entities. There is a join table that is maintaining the relationship. In the standalone initialization application, I create 1 Hardware entity, and 2 Software entities and associate the 2 Software entities with the 1 Hardware entity. The "null" violation is on the joint table; it attempts to assign a null software Id into this join table.

Note that this happens only after I create the database schema via the ant script and then attempt to run the standalone application to populate these entities. All is being run within Netbeans 5.5.1 or 6.0. I can run the application 10 times and each time it will attempt to insert a null into the software Id column of the joint table. If I shutdown the derby database process (without leaving Netbeans) and simply restart the derby database process and then run the application again, it works okay each time.

So there is something about terminating the database server process.
[Message sent by forum member 'bbergquist' (bbergquist)]

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