openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Curtis (JIRA)" <>
Subject [jira] Created: (OPENJPA-1324) Unexpected error when an Entity has multiple columns named id ("id" and "ID")
Date Wed, 23 Sep 2009 14:01:16 GMT
Unexpected error when an Entity has multiple columns named id ("id" and "ID")

                 Key: OPENJPA-1324
             Project: OpenJPA
          Issue Type: Bug
          Components: kernel
         Environment: Win XP, MySQL 5.1.30
            Reporter: Rick Curtis

When doing some artistic testing I came across this problem when I had two fields named id
(id and ID) in my Entity. I'm not sure if this is a valid usage, but I'm documenting this
issue to revisit at a later date.

Note: The table that was generated by the Entity definition below had only one column named

em1.persist(new Book());

public class Book {
    private long id;
    private long ID;

Caused by: <openjpa-2.0.0-SNAPSHOT-r422266:804085M fatal user error> org.apache.openjpa.persistence.ArgumentException:
Attempt to assign id "main.Book-0" to new instance "main.Book-main.Book-0" failed; there is
already an object in the L1 cache with this id. You must delete this object (in a previous
transaction or the current one) before reusing its id.  This error can also occur when a horizontally
or vertically mapped classes uses auto-increment application identity and does not use a hierarchy
of application identity classes.
FailedObject: main.Book-main.Book-0
	at org.apache.openjpa.kernel.ManagedCache.commitNew(
	at org.apache.openjpa.kernel.BrokerImpl.setStateManager(
	at org.apache.openjpa.kernel.StateManagerImpl.commit(
	at org.apache.openjpa.kernel.BrokerImpl.endTransaction(
	... 6 more

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message