users@glassfish.java.net

More information on this problem

From: <glassfish_at_javadesktop.org>
Date: Sun, 13 Jan 2008 17:35:52 PST

In the EJB code that persists the entities, it in effect was doing the following:
1. create the Chassis DeviceEntity
2. perform a query to see if a duplicate value (IP address) would exist based on the value to be assigned
3. populating the rest of the entity if there was no duplicate value
4. persist the Chassis DeviceEntity
5. EntitManager.flush called so that the ID assigned to the Chassis DeviceEntity would be available.

Now options 1 and 2 really should be done in the reverse order, but were not. When in fact I did change the order of these operations the problem no longer occurs. No other changes other than moving the code in step 2 before the code in step 1. This should not have any effect, but in fact it does.
[Message sent by forum member 'bbergquist' (bbergquist)]

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