users@glassfish.java.net

JPA-IntermittentThe attribute [] of class [] is mapped to a primary column

From: <glassfish_at_javadesktop.org>
Date: Wed, 21 Nov 2007 08:16:07 PST

Gentlepeople,

First apologies..this is a cross post from http://forums.oracle.com/forums/thread.jspa?threadID=556949...but I am running out of options and time.....

I get intermittent exceptions key update exceptions and have isolated the issue in a manageable reproducible.

Beans are
- BaseNode, an abstract base class
- Leaf, extends BaseNode
- Node, extends BaseNode
- Order, wraps a Leaf bean

The test
1. creates a Node
2. loops 20 times over
2.1. create 2 Nodes and 1 Leaf
2.2. querie for a not existing BaseNode
2.3. remove the beans created in 2.1

Some of the loops fail with

The attribute [id] of class [Node] is mapped to a primary key column in the database. Updates are not allowed.


Further observations
- changing the name of the Order bean to Wrapper makes the problem go away (Order bean is actually not used at all in the test)
- Removing the Order bean makes the problem go away
- Removing the query (2.2) makes the problem go away
- Have the issue both on jdk 1.5 and 1.6
- Have the issue with all versions of Toplink Essentials I tested
- This a stripped down version, in reality the beans have more properties and there are more beans.

Any ideas...greatly appreciated! Actually, if there are consultants reading this that can get their head around this in a few hours/days and have the time to do so, mail me at pgp dot coppens at gmail dot com

Many thanks indeed!

Peter


The code and persistence.xml is attached
[Message sent by forum member 'pgp_coppens' (pgp_coppens)]

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