users@glassfish.java.net

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

From: <glassfish_at_javadesktop.org>
Date: Wed, 21 Nov 2007 09:36:32 PST

Hello Peter,

I can't figure out why it would think the object is not new. Printing the stack trace might help if it is different from the original posting. Another thing that might help is to add debugging to your entities themselves. For instance, switch to method accessing, and in the setId method, keep track of the stack for the thread that last made a change. When you get this exception, catch it and print off the stack showing where the object causing the exception was changed. ie
setId(int id){
  exception = new Exception();
  this.id = id;
}
..
catch(ValidationException ve){
  nodeorleafcreatedthatcausestheproblem.exception.printStacktrace();
  ve.printStacktrace();
}

This might help show why TopLink thinks the id changed. If you don't know the object that causes the problem, we can try changing the TopLink essentials code that throws the exception to include it.

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

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