You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Mark Struberg (Created) (JIRA)" <ji...@apache.org> on 2012/01/11 18:55:39 UTC

[jira] [Created] (OPENJPA-2107) ManagedCache conflict due adding an entity 2 times in the same query.

ManagedCache conflict due adding an entity 2 times in the same query.
---------------------------------------------------------------------

                 Key: OPENJPA-2107
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2107
             Project: OpenJPA
          Issue Type: Bug
          Components: kernel
    Affects Versions: 2.2.0
            Reporter: Mark Struberg
            Assignee: Mark Struberg
             Fix For: 2.2.0


I have a complex query which creates the following error:

<openjpa-2.2.0-tiss-2-rexported nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Cannot load object with id "26301".  Instance "at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse@6e267b76" with the same id already exists in the L1 cache.  This can occur when you assign an existing id to a new instance, and before flushing attempt to load the existing instance for that id.
FailedObject: at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse-26301
	at org.apache.openjpa.kernel.ManagedCache.add(ManagedCache.java:126)
	at org.apache.openjpa.kernel.BrokerImpl.setStateManager(BrokerImpl.java:4117)
	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:391)
	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:340)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)

It seems that this entity gets loaded from the db twice in the same query.

While hitting the problem, the StateManagers have the following _flags:

orig _flags= 602 = 0010 0101 1010 SAVE LOADED READ_LOCKED OID_ASSIGNED FLUSHED  
sm   _flags= 16  = 0000 0001 0000 READ_LOCKED

And it is really only 1 instance which makes this problem. If I set the 'orig' variable to null in the debugger, the test runs fine.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2107) ManagedCache conflict due adding an entity 2 times in the same query.

Posted by "Rick Curtis (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13185960#comment-13185960 ] 

Rick Curtis commented on OPENJPA-2107:
--------------------------------------

Committed revision 1231375 to trunk.

The root issue is that we only need to reset the Broker flag which indicates if the context has been flushed when we are initializing a new StateManager.

I'm going to leave this issue Open (and assign it to Heath) as it needs to get fixed in 2.0.x and 2.1.x.
                
> ManagedCache conflict due adding an entity 2 times in the same query.
> ---------------------------------------------------------------------
>
>                 Key: OPENJPA-2107
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2107
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Rick Curtis
>             Fix For: 2.2.0
>
>         Attachments: OPENJPA-2107.patch
>
>
> I have a complex query which creates the following error:
> <openjpa-2.2.0-tiss-2-rexported nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Cannot load object with id "26301".  Instance "at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse@6e267b76" with the same id already exists in the L1 cache.  This can occur when you assign an existing id to a new instance, and before flushing attempt to load the existing instance for that id.
> FailedObject: at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse-26301
> 	at org.apache.openjpa.kernel.ManagedCache.add(ManagedCache.java:126)
> 	at org.apache.openjpa.kernel.BrokerImpl.setStateManager(BrokerImpl.java:4117)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:391)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:340)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)
> It seems that this entity gets loaded from the db twice in the same query.
> While hitting the problem, the StateManagers have the following _flags:
> orig _flags= 602 = 0010 0101 1010 SAVE LOADED READ_LOCKED OID_ASSIGNED FLUSHED  
> sm   _flags= 16  = 0000 0001 0000 READ_LOCKED
> And it is really only 1 instance which makes this problem. If I set the 'orig' variable to null in the debugger, the test runs fine.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2107) ManagedCache conflict due adding an entity 2 times in the same query.

Posted by "Mark Struberg (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13185474#comment-13185474 ] 

Mark Struberg commented on OPENJPA-2107:
----------------------------------------

Yes. We also must make a unit test which fails before we apply the patch and works afterwards!
                
> ManagedCache conflict due adding an entity 2 times in the same query.
> ---------------------------------------------------------------------
>
>                 Key: OPENJPA-2107
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2107
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>             Fix For: 2.2.0
>
>         Attachments: OPENJPA-2107.patch
>
>
> I have a complex query which creates the following error:
> <openjpa-2.2.0-tiss-2-rexported nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Cannot load object with id "26301".  Instance "at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse@6e267b76" with the same id already exists in the L1 cache.  This can occur when you assign an existing id to a new instance, and before flushing attempt to load the existing instance for that id.
> FailedObject: at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse-26301
> 	at org.apache.openjpa.kernel.ManagedCache.add(ManagedCache.java:126)
> 	at org.apache.openjpa.kernel.BrokerImpl.setStateManager(BrokerImpl.java:4117)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:391)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:340)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)
> It seems that this entity gets loaded from the db twice in the same query.
> While hitting the problem, the StateManagers have the following _flags:
> orig _flags= 602 = 0010 0101 1010 SAVE LOADED READ_LOCKED OID_ASSIGNED FLUSHED  
> sm   _flags= 16  = 0000 0001 0000 READ_LOCKED
> And it is really only 1 instance which makes this problem. If I set the 'orig' variable to null in the debugger, the test runs fine.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2107) ManagedCache conflict due adding an entity 2 times in the same query.

Posted by "Mark Struberg (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13185287#comment-13185287 ] 

Mark Struberg commented on OPENJPA-2107:
----------------------------------------

Tested and verified. Looks good - txs 4 this quick patch!
Can you please commit it?
                
> ManagedCache conflict due adding an entity 2 times in the same query.
> ---------------------------------------------------------------------
>
>                 Key: OPENJPA-2107
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2107
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>             Fix For: 2.2.0
>
>         Attachments: OPENJPA-2107.patch
>
>
> I have a complex query which creates the following error:
> <openjpa-2.2.0-tiss-2-rexported nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Cannot load object with id "26301".  Instance "at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse@6e267b76" with the same id already exists in the L1 cache.  This can occur when you assign an existing id to a new instance, and before flushing attempt to load the existing instance for that id.
> FailedObject: at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse-26301
> 	at org.apache.openjpa.kernel.ManagedCache.add(ManagedCache.java:126)
> 	at org.apache.openjpa.kernel.BrokerImpl.setStateManager(BrokerImpl.java:4117)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:391)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:340)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)
> It seems that this entity gets loaded from the db twice in the same query.
> While hitting the problem, the StateManagers have the following _flags:
> orig _flags= 602 = 0010 0101 1010 SAVE LOADED READ_LOCKED OID_ASSIGNED FLUSHED  
> sm   _flags= 16  = 0000 0001 0000 READ_LOCKED
> And it is really only 1 instance which makes this problem. If I set the 'orig' variable to null in the debugger, the test runs fine.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-2107) ManagedCache conflict due adding an entity 2 times in the same query.

Posted by "Rick Curtis (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Curtis updated OPENJPA-2107:
---------------------------------

    Affects Version/s: 2.0.1
                       2.1.0
             Assignee: Heath Thomann  (was: Rick Curtis)

Updated fix and affects version.
                
> ManagedCache conflict due adding an entity 2 times in the same query.
> ---------------------------------------------------------------------
>
>                 Key: OPENJPA-2107
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2107
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.0.1, 2.1.0, 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Heath Thomann
>             Fix For: 2.2.0
>
>         Attachments: OPENJPA-2107.patch
>
>
> I have a complex query which creates the following error:
> <openjpa-2.2.0-tiss-2-rexported nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Cannot load object with id "26301".  Instance "at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse@6e267b76" with the same id already exists in the L1 cache.  This can occur when you assign an existing id to a new instance, and before flushing attempt to load the existing instance for that id.
> FailedObject: at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse-26301
> 	at org.apache.openjpa.kernel.ManagedCache.add(ManagedCache.java:126)
> 	at org.apache.openjpa.kernel.BrokerImpl.setStateManager(BrokerImpl.java:4117)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:391)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:340)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)
> It seems that this entity gets loaded from the db twice in the same query.
> While hitting the problem, the StateManagers have the following _flags:
> orig _flags= 602 = 0010 0101 1010 SAVE LOADED READ_LOCKED OID_ASSIGNED FLUSHED  
> sm   _flags= 16  = 0000 0001 0000 READ_LOCKED
> And it is really only 1 instance which makes this problem. If I set the 'orig' variable to null in the debugger, the test runs fine.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (OPENJPA-2107) ManagedCache conflict due adding an entity 2 times in the same query.

Posted by "Rick Curtis (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Curtis updated OPENJPA-2107:
---------------------------------

    Attachment: OPENJPA-2107.patch

Mark -

It looks like we put this bug in with OPENJPA-2051. Give this patch a try.

Note, I haven't had time to try to run this patch through the entire test bucket yet.
                
> ManagedCache conflict due adding an entity 2 times in the same query.
> ---------------------------------------------------------------------
>
>                 Key: OPENJPA-2107
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2107
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>             Fix For: 2.2.0
>
>         Attachments: OPENJPA-2107.patch
>
>
> I have a complex query which creates the following error:
> <openjpa-2.2.0-tiss-2-rexported nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Cannot load object with id "26301".  Instance "at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse@6e267b76" with the same id already exists in the L1 cache.  This can occur when you assign an existing id to a new instance, and before flushing attempt to load the existing instance for that id.
> FailedObject: at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse-26301
> 	at org.apache.openjpa.kernel.ManagedCache.add(ManagedCache.java:126)
> 	at org.apache.openjpa.kernel.BrokerImpl.setStateManager(BrokerImpl.java:4117)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:391)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:340)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)
> It seems that this entity gets loaded from the db twice in the same query.
> While hitting the problem, the StateManagers have the following _flags:
> orig _flags= 602 = 0010 0101 1010 SAVE LOADED READ_LOCKED OID_ASSIGNED FLUSHED  
> sm   _flags= 16  = 0000 0001 0000 READ_LOCKED
> And it is really only 1 instance which makes this problem. If I set the 'orig' variable to null in the debugger, the test runs fine.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (OPENJPA-2107) ManagedCache conflict due adding an entity 2 times in the same query.

Posted by "Albert Lee (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Albert Lee resolved OPENJPA-2107.
---------------------------------

    Resolution: Fixed
    
> ManagedCache conflict due adding an entity 2 times in the same query.
> ---------------------------------------------------------------------
>
>                 Key: OPENJPA-2107
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2107
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.0.1, 2.1.0, 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Heath Thomann
>             Fix For: 2.2.0
>
>         Attachments: OPENJPA-2107.patch
>
>
> I have a complex query which creates the following error:
> <openjpa-2.2.0-tiss-2-rexported nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Cannot load object with id "26301".  Instance "at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse@6e267b76" with the same id already exists in the L1 cache.  This can occur when you assign an existing id to a new instance, and before flushing attempt to load the existing instance for that id.
> FailedObject: at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse-26301
> 	at org.apache.openjpa.kernel.ManagedCache.add(ManagedCache.java:126)
> 	at org.apache.openjpa.kernel.BrokerImpl.setStateManager(BrokerImpl.java:4117)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:391)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:340)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)
> It seems that this entity gets loaded from the db twice in the same query.
> While hitting the problem, the StateManagers have the following _flags:
> orig _flags= 602 = 0010 0101 1010 SAVE LOADED READ_LOCKED OID_ASSIGNED FLUSHED  
> sm   _flags= 16  = 0000 0001 0000 READ_LOCKED
> And it is really only 1 instance which makes this problem. If I set the 'orig' variable to null in the debugger, the test runs fine.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Reopened] (OPENJPA-2107) ManagedCache conflict due adding an entity 2 times in the same query.

Posted by "Heath Thomann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Heath Thomann reopened OPENJPA-2107:
------------------------------------

    
> ManagedCache conflict due adding an entity 2 times in the same query.
> ---------------------------------------------------------------------
>
>                 Key: OPENJPA-2107
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2107
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.0.1, 2.1.0, 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Heath Thomann
>             Fix For: 1.2.3, 2.0.2, 2.1.2, 2.2.0
>
>         Attachments: OPENJPA-2107.patch
>
>
> I have a complex query which creates the following error:
> <openjpa-2.2.0-tiss-2-rexported nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Cannot load object with id "26301".  Instance "at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse@6e267b76" with the same id already exists in the L1 cache.  This can occur when you assign an existing id to a new instance, and before flushing attempt to load the existing instance for that id.
> FailedObject: at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse-26301
> 	at org.apache.openjpa.kernel.ManagedCache.add(ManagedCache.java:126)
> 	at org.apache.openjpa.kernel.BrokerImpl.setStateManager(BrokerImpl.java:4117)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:391)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:340)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)
> It seems that this entity gets loaded from the db twice in the same query.
> While hitting the problem, the StateManagers have the following _flags:
> orig _flags= 602 = 0010 0101 1010 SAVE LOADED READ_LOCKED OID_ASSIGNED FLUSHED  
> sm   _flags= 16  = 0000 0001 0000 READ_LOCKED
> And it is really only 1 instance which makes this problem. If I set the 'orig' variable to null in the debugger, the test runs fine.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Closed] (OPENJPA-2107) ManagedCache conflict due adding an entity 2 times in the same query.

Posted by "Heath Thomann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Heath Thomann closed OPENJPA-2107.
----------------------------------

    
> ManagedCache conflict due adding an entity 2 times in the same query.
> ---------------------------------------------------------------------
>
>                 Key: OPENJPA-2107
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2107
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.0.1, 2.1.0, 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Heath Thomann
>             Fix For: 1.2.3, 2.0.2, 2.1.2, 2.2.0
>
>         Attachments: OPENJPA-2107.patch
>
>
> I have a complex query which creates the following error:
> <openjpa-2.2.0-tiss-2-rexported nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Cannot load object with id "26301".  Instance "at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse@6e267b76" with the same id already exists in the L1 cache.  This can occur when you assign an existing id to a new instance, and before flushing attempt to load the existing instance for that id.
> FailedObject: at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse-26301
> 	at org.apache.openjpa.kernel.ManagedCache.add(ManagedCache.java:126)
> 	at org.apache.openjpa.kernel.BrokerImpl.setStateManager(BrokerImpl.java:4117)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:391)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:340)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)
> It seems that this entity gets loaded from the db twice in the same query.
> While hitting the problem, the StateManagers have the following _flags:
> orig _flags= 602 = 0010 0101 1010 SAVE LOADED READ_LOCKED OID_ASSIGNED FLUSHED  
> sm   _flags= 16  = 0000 0001 0000 READ_LOCKED
> And it is really only 1 instance which makes this problem. If I set the 'orig' variable to null in the debugger, the test runs fine.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2107) ManagedCache conflict due adding an entity 2 times in the same query.

Posted by "Mark Struberg (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13184923#comment-13184923 ] 

Mark Struberg commented on OPENJPA-2107:
----------------------------------------

I now locally reproduced this with a simple Entity. The problematic pattern is to create an entity instance, em.persist it and do a query containing this new entity in the _same_ transaction! The effect only appears if other entities exists which would be returned by the query.


{code}
em.getTransaction().begin();

Semester sem = new Semester();
sem.setYear(2120);
sem.setSeason(SemesterDTO.Season.S);
em.persist(sem);

Query q = em.createQuery("select s from Semester as s where s.season=:season", Semester.class);
q.setParameter("season", SemesterDTO.Season.S);
List<Semester> semesters = q.getResultList();
Assert.assertTrue(semesters.size() > 1); <-- this line crashes!
{code}

I'm currently using the following properties in our persistence.xml

            <property name="openjpa.DynamicEnhancementAgent" value="false"/>

            <!-- disable prepared statement caching -->
            <property name="openjpa.jdbc.QuerySQLCache" value="false"/>

            <property name="openjpa.DataCache" value="false"/>

            <property name="openjpa.Log" value="log4j"/>
            <property name="openjpa.PostLoadOnMerge" value="true" />
            <property name="openjpa.DetachState" value="loaded(DetachedStateField=true)"/>
            <property name="openjpa.Compatibility" value="IgnoreDetachedStateFieldForProxySerialization=true"/>

            <property name="openjpa.jdbc.MappingDefaults"
                      value="ForeignKeyDeleteAction=restrict, JoinForeignKeyDeleteAction=restrict"/>

            <!-- use class per table strategy -->
            <property name="openjpa.Sequence" value="class-table(Table=SEQUENCES, Increment=20, InitialValue=10000)"/>


                
> ManagedCache conflict due adding an entity 2 times in the same query.
> ---------------------------------------------------------------------
>
>                 Key: OPENJPA-2107
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2107
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>             Fix For: 2.2.0
>
>
> I have a complex query which creates the following error:
> <openjpa-2.2.0-tiss-2-rexported nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Cannot load object with id "26301".  Instance "at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse@6e267b76" with the same id already exists in the L1 cache.  This can occur when you assign an existing id to a new instance, and before flushing attempt to load the existing instance for that id.
> FailedObject: at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse-26301
> 	at org.apache.openjpa.kernel.ManagedCache.add(ManagedCache.java:126)
> 	at org.apache.openjpa.kernel.BrokerImpl.setStateManager(BrokerImpl.java:4117)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:391)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:340)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)
> It seems that this entity gets loaded from the db twice in the same query.
> While hitting the problem, the StateManagers have the following _flags:
> orig _flags= 602 = 0010 0101 1010 SAVE LOADED READ_LOCKED OID_ASSIGNED FLUSHED  
> sm   _flags= 16  = 0000 0001 0000 READ_LOCKED
> And it is really only 1 instance which makes this problem. If I set the 'orig' variable to null in the debugger, the test runs fine.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Closed] (OPENJPA-2107) ManagedCache conflict due adding an entity 2 times in the same query.

Posted by "Albert Lee (Closed) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Albert Lee closed OPENJPA-2107.
-------------------------------

    
> ManagedCache conflict due adding an entity 2 times in the same query.
> ---------------------------------------------------------------------
>
>                 Key: OPENJPA-2107
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2107
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.0.1, 2.1.0, 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Heath Thomann
>             Fix For: 2.2.0
>
>         Attachments: OPENJPA-2107.patch
>
>
> I have a complex query which creates the following error:
> <openjpa-2.2.0-tiss-2-rexported nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Cannot load object with id "26301".  Instance "at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse@6e267b76" with the same id already exists in the L1 cache.  This can occur when you assign an existing id to a new instance, and before flushing attempt to load the existing instance for that id.
> FailedObject: at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse-26301
> 	at org.apache.openjpa.kernel.ManagedCache.add(ManagedCache.java:126)
> 	at org.apache.openjpa.kernel.BrokerImpl.setStateManager(BrokerImpl.java:4117)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:391)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:340)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)
> It seems that this entity gets loaded from the db twice in the same query.
> While hitting the problem, the StateManagers have the following _flags:
> orig _flags= 602 = 0010 0101 1010 SAVE LOADED READ_LOCKED OID_ASSIGNED FLUSHED  
> sm   _flags= 16  = 0000 0001 0000 READ_LOCKED
> And it is really only 1 instance which makes this problem. If I set the 'orig' variable to null in the debugger, the test runs fine.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (OPENJPA-2107) ManagedCache conflict due adding an entity 2 times in the same query.

Posted by "Rick Curtis (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-2107?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13185322#comment-13185322 ] 

Rick Curtis commented on OPENJPA-2107:
--------------------------------------

I'll need to spend a few more cycles tomorrow to make sure this isn't going to introduce any other problems... if all goes well, I'll get it in tomorrow afternoon.
                
> ManagedCache conflict due adding an entity 2 times in the same query.
> ---------------------------------------------------------------------
>
>                 Key: OPENJPA-2107
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2107
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Mark Struberg
>             Fix For: 2.2.0
>
>         Attachments: OPENJPA-2107.patch
>
>
> I have a complex query which creates the following error:
> <openjpa-2.2.0-tiss-2-rexported nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Cannot load object with id "26301".  Instance "at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse@6e267b76" with the same id already exists in the L1 cache.  This can occur when you assign an existing id to a new instance, and before flushing attempt to load the existing instance for that id.
> FailedObject: at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse-26301
> 	at org.apache.openjpa.kernel.ManagedCache.add(ManagedCache.java:126)
> 	at org.apache.openjpa.kernel.BrokerImpl.setStateManager(BrokerImpl.java:4117)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:391)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:340)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)
> It seems that this entity gets loaded from the db twice in the same query.
> While hitting the problem, the StateManagers have the following _flags:
> orig _flags= 602 = 0010 0101 1010 SAVE LOADED READ_LOCKED OID_ASSIGNED FLUSHED  
> sm   _flags= 16  = 0000 0001 0000 READ_LOCKED
> And it is really only 1 instance which makes this problem. If I set the 'orig' variable to null in the debugger, the test runs fine.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Assigned] (OPENJPA-2107) ManagedCache conflict due adding an entity 2 times in the same query.

Posted by "Rick Curtis (Assigned) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rick Curtis reassigned OPENJPA-2107:
------------------------------------

    Assignee: Rick Curtis  (was: Mark Struberg)
    
> ManagedCache conflict due adding an entity 2 times in the same query.
> ---------------------------------------------------------------------
>
>                 Key: OPENJPA-2107
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2107
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Rick Curtis
>             Fix For: 2.2.0
>
>         Attachments: OPENJPA-2107.patch
>
>
> I have a complex query which creates the following error:
> <openjpa-2.2.0-tiss-2-rexported nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Cannot load object with id "26301".  Instance "at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse@6e267b76" with the same id already exists in the L1 cache.  This can occur when you assign an existing id to a new instance, and before flushing attempt to load the existing instance for that id.
> FailedObject: at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse-26301
> 	at org.apache.openjpa.kernel.ManagedCache.add(ManagedCache.java:126)
> 	at org.apache.openjpa.kernel.BrokerImpl.setStateManager(BrokerImpl.java:4117)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:391)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:340)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)
> It seems that this entity gets loaded from the db twice in the same query.
> While hitting the problem, the StateManagers have the following _flags:
> orig _flags= 602 = 0010 0101 1010 SAVE LOADED READ_LOCKED OID_ASSIGNED FLUSHED  
> sm   _flags= 16  = 0000 0001 0000 READ_LOCKED
> And it is really only 1 instance which makes this problem. If I set the 'orig' variable to null in the debugger, the test runs fine.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (OPENJPA-2107) ManagedCache conflict due adding an entity 2 times in the same query.

Posted by "Heath Thomann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-2107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Heath Thomann resolved OPENJPA-2107.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.2
                   2.0.2
                   1.2.3
    
> ManagedCache conflict due adding an entity 2 times in the same query.
> ---------------------------------------------------------------------
>
>                 Key: OPENJPA-2107
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-2107
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 2.0.1, 2.1.0, 2.2.0
>            Reporter: Mark Struberg
>            Assignee: Heath Thomann
>             Fix For: 1.2.3, 2.0.2, 2.1.2, 2.2.0
>
>         Attachments: OPENJPA-2107.patch
>
>
> I have a complex query which creates the following error:
> <openjpa-2.2.0-tiss-2-rexported nonfatal user error> org.apache.openjpa.persistence.ArgumentException: Cannot load object with id "26301".  Instance "at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse@6e267b76" with the same id already exists in the L1 cache.  This can occur when you assign an existing id to a new instance, and before flushing attempt to load the existing instance for that id.
> FailedObject: at.ac.tuwien.tiss.curriculum.be.entities.DefaultCourse-26301
> 	at org.apache.openjpa.kernel.ManagedCache.add(ManagedCache.java:126)
> 	at org.apache.openjpa.kernel.BrokerImpl.setStateManager(BrokerImpl.java:4117)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:391)
> 	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:340)
> 	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:378)
> It seems that this entity gets loaded from the db twice in the same query.
> While hitting the problem, the StateManagers have the following _flags:
> orig _flags= 602 = 0010 0101 1010 SAVE LOADED READ_LOCKED OID_ASSIGNED FLUSHED  
> sm   _flags= 16  = 0000 0001 0000 READ_LOCKED
> And it is really only 1 instance which makes this problem. If I set the 'orig' variable to null in the debugger, the test runs fine.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira