Uploaded image for project: 'MidPoint'
  1. MidPoint
  2. MID-5105

RObjectReference vs RObjectReferenceId inconsistency

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.9, 4.0
    • Fix Version/s: 4.1, 4.0.2
    • Component/s: None
    • Labels:
      None
    • Subscription:
      Active subscription

      Description

      Looks like RObjectReference cares for target type while RObjectReferenceId does not.

      This might cause MID-5102 (but I cannot imagine the exact mechanism how).

      How to replicate: set value of metadata/modifyApproverRef to reference list of (oid, null) and (oid, UserType). The following exception is thrown:

      com.evolveum.midpoint.util.exception.SystemException: A different object with the same identifier value was already associated with the session : [com.evolveum.midpoint.repo.sql.data.common.RObjectReference#RObjectReferenceId[oid-360,approver1-oid,http://midpoint.evolveum.com/xml/ns/public/common/org-3#default,MODIFY_APPROVER]]
      
      	at com.evolveum.midpoint.repo.sql.helpers.BaseHelper.handleGeneralRuntimeException(BaseHelper.java:173)
      	at com.evolveum.midpoint.repo.sql.helpers.BaseHelper.handleGeneralException(BaseHelper.java:153)
      	at com.evolveum.midpoint.repo.sql.helpers.ObjectUpdater.modifyObjectAttempt(ObjectUpdater.java:488)
      	at com.evolveum.midpoint.repo.sql.SqlRepositoryServiceImpl.modifyObject(SqlRepositoryServiceImpl.java:573)
      	at com.evolveum.midpoint.repo.sql.SqlRepositoryServiceImpl.modifyObject(SqlRepositoryServiceImpl.java:511)
      	at com.evolveum.midpoint.repo.sql.testing.TestSqlRepositoryServiceImpl.modifyObject(TestSqlRepositoryServiceImpl.java:76)
      	at com.evolveum.midpoint.repo.sql.ModifyTest.test360ReplaceModifyApprovers(ModifyTest.java:1144)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
      	at org.testng.internal.MethodInvocationHelper$1.runTestMethod(MethodInvocationHelper.java:200)
      	at org.springframework.test.context.testng.AbstractTestNGSpringContextTests.run(AbstractTestNGSpringContextTests.java:180)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:212)
      	at org.testng.internal.Invoker.invokeMethod(Invoker.java:707)
      	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
      	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
      	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
      	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
      	at org.testng.TestRunner.privateRun(TestRunner.java:767)
      	at org.testng.TestRunner.run(TestRunner.java:617)
      	at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
      	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343)
      	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305)
      	at org.testng.SuiteRunner.run(SuiteRunner.java:254)
      	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
      	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
      	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
      	at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
      	at org.testng.TestNG.run(TestNG.java:1057)
      	at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:73)
      	at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)
      Caused by: javax.persistence.EntityExistsException: A different object with the same identifier value was already associated with the session : [com.evolveum.midpoint.repo.sql.data.common.RObjectReference#RObjectReferenceId[oid-360,approver1-oid,http://midpoint.evolveum.com/xml/ns/public/common/org-3#default,MODIFY_APPROVER]]
      	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:118)
      	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:157)
      	at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:164)
      	at org.hibernate.internal.SessionImpl.doFlush(SessionImpl.java:1443)
      	at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:493)
      	at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:3207)
      	at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2413)
      	at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:473)
      	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:156)
      	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$100(JdbcResourceLocalTransactionCoordinatorImpl.java:38)
      	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:231)
      	at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:68)
      	at com.evolveum.midpoint.repo.sql.helpers.ObjectUpdater.modifyObjectAttempt(ObjectUpdater.java:471)
      	... 34 more
      

      See ModifyTest.test360ReplaceModifyApprovers on support-3.9 branch.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mederly Pavol Mederly
              Reporter:
              mederly Pavol Mederly
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: