Tauqeer Ansari | 29 Jun 01:59 2016
Picon

OpenJPA 2.2.3 Jar Issue

Hi Team,

We were using openjpa-2.1.2 (Came with WebSphere 8.0) with WebSphere 8.0, IBM Java 6 and PAI 5.0 and it was working fine.

Now, We have upgraded to WebSphere 8.5, PAI 5.5, IBM Java 7. openjpa-2.2.3 came with WebSphere 8.5. So, we have changed openjpa used in code to 2.2.3 by copying it from the WebSphere plugins folder and also changed other plugins that came with WebSphere with 8.5 by replacing with 8.0 (old).

When we try execute the below query, it is throwing exception and transaction get rolled back.

Attached JPA file shows the combination with status and also error/warning we are getting.

The query that we are trying to execute is as follow.

public VariantContainerVersionBE readVCVersionForVCMasterAndCVMVersion(UUID cvmVersionPK, UUID vcMasterPK) {

String queryString = "SELECT vcVersion FROM " + VariantContainerVersionBE.ENTITY_NAME + " vcVersion "

+ " JOIN vcVersion." + VariantContainerVersionBE.CVMVERSIONVCVERSIONS + " AS cvmv2vcv "

+ " JOIN cvmv2vcv." + CVMVersionVCVersionBE.COMPONENTVARIANTMASTERVERSION + " AS cvmVersions "

+ " WHERE vcVersion." + VariantContainerVersionBE.VARIANTCONTAINERMASTER + "."

+ VariantContainerMasterBE.PRIMARYKEY + "=:vcMasterPK" + " AND  cvmVersions."

+ ComponentVariantMasterVersionBE.PRIMARYKEY + "=:cvmVersionPK";

Query q = em.createQuery(queryString);

q.setParameter("cvmVersionPK", cvmVersionPK.toString());

q.setParameter("vcMasterPK", vcMasterPK.toString());

return (VariantContainerVersionBE) q.getResultList().get(0);

}

We are tying to execute same query two times in a same transaction with same UUID's. It should work as it was working with openjpa-2.1.2.

Just for your reference, if we add em.flush() before em.createQuery(queryString); then it works.

We are getting error only for the above query and it is working fine with other jpa queries.

I have also attached complete stacktrace file.

I have seen that the issue was there before 2.1.2 and solved in 2.1.2 and 2.2.0.

OPENJPA-2107

Is it the case that the issue reentered by anychance?

Can you please verify and suggest some steps to solve this issue?

Thanks and Regards,

Tauqeer

+91 9699522589

Caused by: <openjpa-2.2.3-SNAPSHOT-r422266:1708660 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: Cannot load object with id
"c6f8b144-ba12-4c2f-b29e-3643545f6c8d".  Instance
"com.daimler.epdm.business.cvm.entity.VariantContainerVersionBE <at> e166e64" 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: com.daimler.epdm.business.cvm.entity.VariantContainerVersionBE-c6f8b144-ba12-4c2f-b29e-3643545f6c8d
	at org.apache.openjpa.kernel.ManagedCache.add(ManagedCache.java:126)
	at org.apache.openjpa.kernel.BrokerImpl.setStateManager(BrokerImpl.java:4136)
	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:386)
	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:348)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:380)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:306)
	at com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCStoreManager.initialize(WsJpaJDBCStoreManager.java:178)
	at org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:112)
	at org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
	at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:1051)
	at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:1009)
	at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:931)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1033)
	at com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCStoreManager.load(WsJpaJDBCStoreManager.java:143)
	at org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:280)
	at org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2381)
	at org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:274)
	at org.apache.openjpa.jdbc.kernel.InstanceResultObjectProvider.getResultObject(InstanceResultObjectProvider.java:60)
	at org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:36)
	at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1258)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1014)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:870)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:801)
	at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542)
	at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:286)
	at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:302)
	at com.ibm.ws.persistence.QueryImpl.getResultList(QueryImpl.java:118)
	at org.apache.openjpa.persistence.QueryImpl.getSingleResult(QueryImpl.java:330)
	at com.daimler.epdm.business.cvm.impl.CVMDAOImpl.readVCVersionForVCMasterAndCVMVersion(CVMDAOImpl.java:1261)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.EJSContainer.invokeProceed(EJSContainer.java:5730)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:568)
	at com.daimler.epdm.business.common.PerfLogStopWatchInterceptor.measurePerformance(PerfLogStopWatchInterceptor.java:202)
	at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:548)
	at com.daimler.epdm.common.testbase.TestInterceptor.proceedWithTempMocks(TestInterceptor.java:49)
	at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:548)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.doAroundInvoke(InvocationContextImpl.java:229)
	at com.ibm.ejs.container.EJSContainer.invoke(EJSContainer.java:5621)
	... 169 more
[6/23/16 7:27:13:272 CEST] 0000014a SystemOut     O 2016-06-23 07:27:13.272 [FINEST]
com.daimler.epdm.business.common, server1, , handleException:
<openjpa-2.2.3-SNAPSHOT-r422266:1708660 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: Cannot load object with id
"c6f8b144-ba12-4c2f-b29e-3643545f6c8d".  Instance
"com.daimler.epdm.business.cvm.entity.VariantContainerVersionBE <at> e166e64" 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: com.daimler.epdm.business.cvm.entity.VariantContainerVersionBE-c6f8b144-ba12-4c2f-b29e-3643545f6c8d
<openjpa-2.2.3-SNAPSHOT-r422266:1708660 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: Cannot load object with id
"c6f8b144-ba12-4c2f-b29e-3643545f6c8d".  Instance
"com.daimler.epdm.business.cvm.entity.VariantContainerVersionBE <at> e166e64" 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: com.daimler.epdm.business.cvm.entity.VariantContainerVersionBE-c6f8b144-ba12-4c2f-b29e-3643545f6c8d
	at org.apache.openjpa.kernel.ManagedCache.add(ManagedCache.java:126)
	at org.apache.openjpa.kernel.BrokerImpl.setStateManager(BrokerImpl.java:4136)
	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:386)
	at org.apache.openjpa.kernel.StateManagerImpl.initialize(StateManagerImpl.java:348)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initializeState(JDBCStoreManager.java:380)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.initialize(JDBCStoreManager.java:306)
	at com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCStoreManager.initialize(WsJpaJDBCStoreManager.java:178)
	at org.apache.openjpa.kernel.DelegatingStoreManager.initialize(DelegatingStoreManager.java:112)
	at org.apache.openjpa.kernel.ROPStoreManager.initialize(ROPStoreManager.java:57)
	at org.apache.openjpa.kernel.BrokerImpl.initialize(BrokerImpl.java:1051)
	at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:1009)
	at org.apache.openjpa.kernel.BrokerImpl.find(BrokerImpl.java:931)
	at org.apache.openjpa.jdbc.kernel.JDBCStoreManager.load(JDBCStoreManager.java:1033)
	at com.ibm.ws.persistence.jdbc.kernel.WsJpaJDBCStoreManager.load(WsJpaJDBCStoreManager.java:143)
	at org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:280)
	at org.apache.openjpa.jdbc.sql.SelectImpl$SelectResult.load(SelectImpl.java:2381)
	at org.apache.openjpa.jdbc.sql.AbstractResult.load(AbstractResult.java:274)
	at org.apache.openjpa.jdbc.kernel.InstanceResultObjectProvider.getResultObject(InstanceResultObjectProvider.java:60)
	at org.apache.openjpa.lib.rop.EagerResultList.<init>(EagerResultList.java:36)
	at org.apache.openjpa.kernel.QueryImpl.toResult(QueryImpl.java:1258)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:1014)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:870)
	at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:801)
	at org.apache.openjpa.kernel.DelegatingQuery.execute(DelegatingQuery.java:542)
	at org.apache.openjpa.persistence.QueryImpl.execute(QueryImpl.java:286)
	at org.apache.openjpa.persistence.QueryImpl.getResultList(QueryImpl.java:302)
	at com.ibm.ws.persistence.QueryImpl.getResultList(QueryImpl.java:118)
	at org.apache.openjpa.persistence.QueryImpl.getSingleResult(QueryImpl.java:330)
	at com.daimler.epdm.business.cvm.impl.CVMDAOImpl.readVCVersionForVCMasterAndCVMVersion(CVMDAOImpl.java:1261)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.EJSContainer.invokeProceed(EJSContainer.java:5730)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:568)
	at com.daimler.epdm.business.common.PerfLogStopWatchInterceptor.measurePerformance(PerfLogStopWatchInterceptor.java:202)
	at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:548)
	at com.daimler.epdm.common.testbase.TestInterceptor.proceedWithTempMocks(TestInterceptor.java:49)
	at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:548)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.doAroundInvoke(InvocationContextImpl.java:229)
	at com.ibm.ejs.container.EJSContainer.invoke(EJSContainer.java:5621)
	at com.daimler.epdm.business.cvm.impl.EJSLocal1SLCVMDAOImpl_4ab35259.readVCVersionForVCMasterAndCVMVersion(EJSLocal1SLCVMDAOImpl_4ab35259.java)
	at com.daimler.epdm.business.cvm.impl.CVMQueryBOImpl.readVCWithCVMSNRInfoAndSNR(CVMQueryBOImpl.java:331)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.EJSContainer.invokeProceed(EJSContainer.java:5730)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:568)
	at com.daimler.epdm.common.testbase.TestInterceptor.proceedWithTempMocks(TestInterceptor.java:49)
	at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:548)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.doAroundInvoke(InvocationContextImpl.java:229)
	at com.ibm.ejs.container.EJSContainer.invoke(EJSContainer.java:5621)
	at com.daimler.epdm.business.cvm.impl.EJSLocal0SLCVMQueryBOImpl_cb1d46b5.readVCWithCVMSNRInfoAndSNR(EJSLocal0SLCVMQueryBOImpl_cb1d46b5.java)
	at com.daimler.epdm.business.cvm.impl.CVMBMFImpl.readVCWithCVMSNRInfoAndSNRImpl(CVMBMFImpl.java:1548)
	at com.daimler.epdm.business.cvm.impl.CVMBMFAbstractBase.readVCWithCVMSNRInfoAndSNR(CVMBMFAbstractBase.java:6670)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.EJSContainer.invokeProceed(EJSContainer.java:5730)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:568)
	at com.daimler.epdm.business.common.PBRInterceptor.initSession(PBRInterceptor.java:135)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:548)
	at com.daimler.epdm.business.common.PerformanceFiguresInterceptor.log(PerformanceFiguresInterceptor.java:102)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:548)
	at com.daimler.epdm.business.common.PerfLogStopWatchInterceptor.measurePerformance(PerfLogStopWatchInterceptor.java:202)
	at sun.reflect.GeneratedMethodAccessor22.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:548)
	at com.daimler.epdm.business.common.ExceptionWrapperInterceptor.invokeBusinessMethod(ExceptionWrapperInterceptor.java:97)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:548)
	at com.daimler.epdm.common.testbase.TestInterceptor.proceedWithTempMocks(TestInterceptor.java:49)
	at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:548)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.doAroundInvoke(InvocationContextImpl.java:229)
	at com.ibm.ejs.container.EJSContainer.invoke(EJSContainer.java:5621)
	at com.daimler.epdm.business.cvm.EJSLocal6SLCVMBMFImpl_c6285397.readVCWithCVMSNRInfoAndSNR(EJSLocal6SLCVMBMFImpl_c6285397.java)
	at com.daimler.epdm.business.comp.impl.CvuVersionBOImpl.readVarContainerVersionAndMaster(CvuVersionBOImpl.java:3022)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.EJSContainer.invokeProceed(EJSContainer.java:5730)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:568)
	at com.daimler.epdm.common.testbase.TestInterceptor.proceedWithTempMocks(TestInterceptor.java:49)
	at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:548)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.doAroundInvoke(InvocationContextImpl.java:229)
	at com.ibm.ejs.container.EJSContainer.invoke(EJSContainer.java:5621)
	at com.daimler.epdm.business.comp.impl.EJSLocal0SLCvuVersionBOImpl_20a34ce5.readVarContainerVersionAndMaster(EJSLocal0SLCvuVersionBOImpl_20a34ce5.java)
	at com.daimler.epdm.business.comp.impl.COMPBMFImpl.addCVMVersionToCVUVersionImpl(COMPBMFImpl.java:723)
	at com.daimler.epdm.business.comp.impl.COMPBMFAbstractBase.addCVMVersionToCVUVersion(COMPBMFAbstractBase.java:355)
	at com.daimler.epdm.business.comp.impl.COMPBMFImpl.addNewCVMToCVUVersionImpl(COMPBMFImpl.java:2227)
	at com.daimler.epdm.business.comp.impl.COMPBMFAbstractBase.addNewCVMToCVUVersion(COMPBMFAbstractBase.java:785)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.EJSContainer.invokeProceed(EJSContainer.java:5730)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:568)
	at com.daimler.epdm.business.common.PBRInterceptor.initSession(PBRInterceptor.java:135)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:548)
	at com.daimler.epdm.business.common.PerformanceFiguresInterceptor.log(PerformanceFiguresInterceptor.java:102)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:548)
	at com.daimler.epdm.business.common.PerfLogStopWatchInterceptor.measurePerformance(PerfLogStopWatchInterceptor.java:202)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:548)
	at com.daimler.epdm.business.common.ExceptionWrapperInterceptor.invokeBusinessMethod(ExceptionWrapperInterceptor.java:97)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:548)
	at com.daimler.epdm.common.testbase.TestInterceptor.proceedWithTempMocks(TestInterceptor.java:49)
	at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:548)
	at com.ibm.ejs.container.interceptors.InvocationContextImpl.doAroundInvoke(InvocationContextImpl.java:229)
	at com.ibm.ejs.container.EJSContainer.invoke(EJSContainer.java:5621)
	at com.daimler.epdm.business.comp.EJSRemote9SLCOMPBMFImpl_26e900c2.addNewCVMToCVUVersion(EJSRemote9SLCOMPBMFImpl_26e900c2.java)
	at com.daimler.epdm.business.comp._COMPAdminService_Stub.addNewCVMToCVUVersion(_COMPAdminService_Stub.java:1)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:88)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at dcx.integration.service.HttpRpcServlet.invokeEJBMethod(HttpRpcServlet.java:520)
	at dcx.integration.service.HttpRpcServlet.invoke(HttpRpcServlet.java:498)
	at dcx.integration.service.HttpRpcServlet.handlePostRequest(HttpRpcServlet.java:431)
	at dcx.integration.service.AbstractHttpServlet.doPost(AbstractHttpServlet.java:82)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:595)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:668)
	at com.ibm.ws.cache.servlet.ServletWrapper.serviceProxied(ServletWrapper.java:307)
	at com.ibm.ws.cache.servlet.CacheHook.handleFragment(CacheHook.java:562)
	at com.ibm.ws.cache.servlet.CacheHook.handleServlet(CacheHook.java:255)
	at com.ibm.ws.cache.servlet.ServletWrapper.service(ServletWrapper.java:259)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1232)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:781)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:480)
	at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)
	at com.daimler.iap.wasextensions.servletfilter.UserSessionDataFilter.doFilter(UserSessionDataFilter.java:123)
	at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
	at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:967)
	at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107)
	at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3926)
	at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
	at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1007)
	at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
	at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:287)
	at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
	at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
	at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
	at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
	at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
	at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
	at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
	at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
	at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
	at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1881)
Attachment (JPA.docx): application/vnd.openxmlformats-officedocument.wordprocessingml.document, 17 KiB
PashaTurok | 9 Jun 13:02 2016
Picon

Does OpenJPA work with OSGi?

The software we work on is fully on OSGi. So we need  JPA implementation
which can WELL work with OSGI. Currently we use eclipselink (2.6.3)+eclipse
gemini. The problem is that according to specs (jpa or osgi-ee ?) entities
are not supported to be in different bundles. However, the developer of
gemini said that he also doesn't understand this issue with specs and finds
it strange that's why he allowed using entities from different bundles,
although no special work was done. 

So eclipselink somehow works with osgi. However, we came across the
following problem. We have two entities: ClassA and ClassB. ClassA extends
ClassB. ClassA is in one bundle, ClassB in in another bundle. We need
EntityGraph (FetchGroup). EclipseLink needs weaving for FetchGroup. However,
we couldn't make weaving (static and dynamic) work with our situation (it
doesn't support classes be in different bundles).

So the question - can OpenJPA do what we need: entity graph + osgi support
of entities?

--
View this message in context: http://openjpa.208410.n2.nabble.com/Does-OpenJPA-work-with-OSGi-tp7589204.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Leonardo Carvalho | 17 May 18:20 2016
Picon

Const.class conflict


  Hi guys.

  I'm creating a StartsWith and IgnoreCase JPARepository method using SpringData and OpenJPA.
  I've got a strange issue.

  The query is perfect:



  But at runtime, it fails with the message:

  "The filter listener "matches" requires a constant argument. "

  And that looks like is caused by using com.sun.xml.internal.bind.v2.runtime.reflect.opt.Const instead of org.apache.openjpa.jdbc.kernel.exps.Const on the test operation at org.apache.openjpa.jdbc.kernel.exps.JDBCExpressionFactory line 175.



   I'm using Maven 3 and Java 8. Is there a way to solve this apparent conflict?

   Thanks

--


 

Leonardo Trindade de Carvalho

Senior Programmer

SiBBr | MCTI | PNUMA (UNEP)

Phone: +55 61 3329 6031 r6045
Phone: +55 48 8405 4119

trindade-BUiaNDv81daL9npaI8a6UQ@public.gmane.org

www.sibbr.gov.br

 
Senthil Kumar Sekar | 12 May 05:09 2016

Open JPA Entity Loading issue due to failure in Enhancing at run time.


Hello Team,
               We have been using openjpa – 2.4.0 for our application data access layer which will be deployed in Jboss
Fuse 6.2.1.
We have persistence xml where all the entities are declared.

Very Frequently that we are facing the below issue and had to restart the container multiple to get the issue resolved.

java.lang.reflect.UndeclaredThrowableException
        at com.sun.proxy.$Proxy29.createQuery(Unknown Source)
        at com.mysema.query.jpa.impl.AbstractJPAQuery.createQuery(AbstractJPAQuery.java:127)[744:com.mysema.querydsl.jpa:3.6.3]
               …………….
Caused by: java.lang.reflect.UndeclaredThrowableException
        at com.sun.proxy.$Proxy103.createQuery(Unknown Source)
        ... 67 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.GeneratedMethodAccessor112.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_79]
        at java.lang.reflect.Method.invoke(Method.java:606)[:1.7.0_79]
        at org.apache.aries.jpa.container.impl.EntityManagerProxyFactory$EMHandler.invoke(EntityManagerProxyFactory.java:31)
        ... 68 more
Caused by: <openjpa-2.4.0-r422266:1674604 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: An error occurred while parsing the query
filter "select cETAssignmentException_
from CETAssignmentException cETAssignmentException_
where lower(cETAssignmentException_.id.officeCode) = ?1 and
lower(cETAssignmentException_.id.businessSegmentCode) = ?2". Error message: The name
"CETAssignmentException" is not a recognized entity or identifier. Perhaps you meant
CDDCaseLocation, which is a close match. Known entity names: [IndividualReferencesAsu, RmaExcllist,
WbSanctionsQuestionnaire, IndividualAsu, SpeDocumentsChecklist, Property, MvSciClientGrpInfo,
CddAdditionalDetails, CopiFatcaSubownersInfo, DocumentTemplate, ClientBranchOffices,
RoccoDecisionReportPK, CddCaseActorsPK, DdCase, ClientIndividualReln, EcddSciCasePublish,
ForeignExchange, CaseDetail, CopiFatcaTaxInfo, NorkomTxn, CopiFatcaDocument, ClientGroup,
ClientIndividual, OpaScreen, Country, MvSciClientInfo, IndividualNorkom, CddRisks,
IndividualNorkomAsu, ClientOfficeProducts, CddCaseAuditPK, AtfFieldsMaster,
CddDdrBasedRouting, PreScreening, CddCasePK, MvSciClientOrgInfo, WorkflowState, RoccoRequest,
RoccoRequestAuditPK, Risks, MvSciClientAddrInfo, GaProductTransaction, ClientDocuments, Bba,
ClientBranch, ClientNorkomPK, ClientISIC, MvSciArmCodeInfo, DDCCountries, Client, GroupNorkom,
IndividualClientReln, Ga, OPARuleBases, CDDWorkflowState, SubReasonCodes, MoneyMarket,
OpaError, DefenceGoodsStatus, CDDStateMachine, LegalConstitution, ReasonCodes,
RoccoRequestAudit, Address, BranchNorkom, FiDocumentsChecklist, CopiFatcaStatusInfo, CddCase,
Cdd, CddPepSummary, Bonds, BbaDocumentsChecklist, ClientOffice, CDDCaseLocation, MvSciEmpInfo,
GaDocumentChecklist, TaskBasedReasonCodes, BranchAddress, DgStatusDecisionMatrix,
CashEquities, IndividualReferences, EcddSciPublish, CddCaseAudit, BusinessSubSegment,
OPACases, ClientIndividualRelnPK, IndividualReferencesAsuPK, Product, ClientNorkom,
BusinessSegment, DocumentCategory, CoDocumentsChecklist, CddCaseAuditSubReasons,
IndividualClientRelnAsu, TaskBasedReasonCodesPK, CustomerCountryRisk, PreScreeningComment,
BbaRiskQuestion, IndividualDocuments, FormButton, Documents, BbaAdditionalDetails, ClientType,
GuarantorNorkomPK, AnticipatedTransaction, CddPepDetail, GoodsType, CddCaseActors,
GuarantorNorkom, CddCountryRisk, CountryOffices, CopiFatca, CddWorkflowReassignment, Norkom,
Deferral, DocumentsUpload, ClientTriggerEvents, CopiFatcaStatus, Gic, BusinessSubSegmentPK,
ParentGroupDetails, MvSciClientCoreInfo, RequestMap, CddRiskQuestions, DefenceGoods,
OPADecisionReport, AtfRequestTxn, Individual, ReviewCases, MvSciArmLocation,
DefenceGoodsDecision, ClientIndividualPK, RoccoDecisionReport, IndividualPK, CddTaskAction,
PreScreeningRef, ClientGuarantor, Derivative]
        at org.apache.openjpa.kernel.exps.AbstractExpressionBuilder.parseException(AbstractExpressionBuilder.java:118)[848:org.apache.openjpa:2.4.0]
        at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.getClassMetaData(JPQLExpressionBuilder.java:193)[848:org.apache.openjpa:2.4.0]
        at org.apache.openjpa.kernel.jpql.JPQLExpressionBuilder.resolveClassMetaData(JPQLExpressionBuilder.java:166)[848:org.apache.openjpa:2.4.0]

Looks like the entity CETAssignmentException is not in the open-jpa list which is used in setting the
values using Reflection.

Below is the TRACE log enabled in openjpa.

3724779  bowbMSPersistenceUnit  WARN   [qtp1069331902-407] openjpa.MetaData - The class
"com.scb.cic.wb.cdd.ds.db.model.sci.SciOffices" listed in the openjpa.MetaDataFactory
configuration property could not be loaded by wb-svc-cdd [970]; ignoring.
3724779  bowbMSPersistenceUnit  WARN   [qtp1069331902-407] openjpa.MetaData - The class
"com.scb.cic.wb.cdd.ds.db.model.sci.SciAssignment" listed in the openjpa.MetaDataFactory
configuration property could not be loaded by wb-svc-cdd [970]; ignoring.
3724779  bowbMSPersistenceUnit  WARN   [qtp1069331902-407] openjpa.MetaData - The class
"com.scb.cic.wb.cdd.ds.db.model.task.CETAssignmentExceptionPK" listed in the
openjpa.MetaDataFactory configuration property could not be loaded by wb-svc-cdd [970]; ignoring.
3724779  bowbMSPersistenceUnit  WARN   [qtp1069331902-407] openjpa.MetaData - The class
"com.scb.cic.wb.cdd.ds.db.model.task.CETAssignmentException" listed in the
openjpa.MetaDataFactory configuration property could not be loaded by wb-svc-cdd [970]; ignoring.

and debugged with the source code and found that

private Class<?> classForName(String name, ClassLoader loader) {
        try {
            return Class.forName(name, true, loader);
        } catch (Exception e) {
            if ((_validate & VALIDATE_RUNTIME) != 0) {
                if (_log.isWarnEnabled())
                    _log.warn(_loc.get("bad-discover-class", name, loader));
            } else if (_log.isInfoEnabled())
                _log.info(_loc.get("bad-discover-class", name, loader));
            if (_log.isTraceEnabled())
                _log.trace(e);
        } catch (NoSuchMethodError nsme) {
            if (nsme.getMessage().indexOf(".pc") == -1)
                throw nsme;

            // if the error is about a method that uses the PersistenceCapable
            // 'pc' method prefix, perform some logging and continue. This
            // probably just means that the class is not yet enhanced.
            if ((_validate & VALIDATE_RUNTIME) != 0) {
                if (_log.isWarnEnabled())
                    _log.warn(_loc.get("bad-discover-class", name, loader));
            } else if (_log.isInfoEnabled())
                _log.info(_loc.get("bad-discover-class", name, loader));
            if (_log.isTraceEnabled())
                _log.trace(nsme);
        }
        return null;
    }

Above entities are ignored in enhancement while the class is loaded. So, added below in persistence.xml

<property name="openjpa.RuntimeUnenhancedClasses" value="supported"/> --> in order to enhance
dynamically during run time.

Additionally we have also enabled enhancement during build time by
<plugin>
                    <groupId>org.apache.openjpa</groupId>
                    <artifactId>openjpa-maven-plugin</artifactId>
                    <version>${openjpa-maven-plugin.version}</version>

                    <configuration>
                    </configuration>

                    <executions>
                        <execution>
                            <id>enhancer</id>
                            <phase>process-classes</phase>
                            <goals>
                                <goal>enhance</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>

But still facing the same issue.

This issue has become a serious issue. It would be great if the team could help us in resolving the issue.

Thanks.

Regards
Senthil Kumar Sekar

Dan Rollo | 3 May 16:41 2016
Picon
Gravatar

Doc issue

On the following page, the referenced property example to add to ‘persistence.xml’ is not visible in FF, Chrome, nor Safari:

http://openjpa.apache.org/entity-enhancement.html

See the section: OPENJPA-952
The last line of that section does not display the example property. (screenshot attached)

Here’s the page source snippet:
<blockquote>
<p>[java] 1047  jpa_app    WARN   [main] openjpa.Enhance - Unenhanced classes were
detected even though the enhancer has ran. Ensure that the
EntityManagerFactory is created prior to creating any Entities.</p>
</blockquote>
<p>If your application uses some other method of enhancement, this support can be explicitly disabled by setting the following property in your persistence.xml.</p>
<blockquote>
<p><property name="openjpa.DynamicEnhancementAgent" value="false"/></p>
</blockquote>
<p><a name="EntityEnhancement-SubclassingEnhancement"></a></p>


Matthew Broadhead | 2 May 15:59 2016
Picon

MySQL text field becomes Object

Hi,

I searched the list but couldn't find the answer to this problem.

Using Eclipse IDE when I "Generate Entities from Tables" MySQL text 
fields becomes Objects.  Does OpenJPA not work well with MySQL text 
fields?  Should I be using something else instead?  Or is there perhaps 
a setting I can put somewhere to deal with this problem?

Thanks, Matthew

Sergey Beryozkin | 26 Apr 11:44 2016
Picon

Unexpected 'right truncation' issue

Hi All

This is my first post to the list, I've tried to solve the issue myself 
by checking StackOverflow, etc. I thought I'd give it a try at OpenJPA 
users list, given that I do work with OpenJPA 2.4.0.

I have the following class hierarchy (listing the most relevant details):

 <at> Entity
public class Client {
    private String clientId;
}

 <at> Entity
public class BearerAccessToken extends ServerAccessToken {
}

 <at> MappedSuperclass
public abstract class ServerAccessToken extends AccessToken {

 <at> ManyToOne
private Client client;
}

 <at> MappedSuperclass
public abstract class AccessToken {

 <at> Id
String tokenKey;

 <at> ElementCollection
 <at> MapKeyColumn(name="propName")
private Map<String, String> parameters = new LinkedHashMap<String, 
String>();
}

Now, after initializing the DB as follows:

- Create Client instance (ex, "Client1"), add it to DB:
   Client c1 = new Client("Client1"); // and save
- Create another Client instance (ex, "Client2"), add it to DB:
   Client c2 = new Client("Client2"); // and save
- add a new BearerAccessToken associated with Client2 to DB:
   BearerAccessToken at = new BearerAccessToken();
   at.setClient(c2); // and save

(Note no tokens are associated with Client1)

the following sequence works OK:

1. delete Client2 (c2)
2. delete Client1 (c1)

This is OK, but if I start from deleting Client1 (the one with no 
tokens) I immediately see:

Caused by: <openjpa-2.4.0-r422266:1674604 fatal general error> 
org.apache.openjpa.persistence.PersistenceException: data exception: 
string data, right truncation;  table: BEARERACCESSTOKEN_PARAMETERS 
column: VALUE {prepstmnt 453026232 INSERT INTO 
BearerAccessToken_parameters (BEARERACCESSTOKEN_TOKENKEY, propName, 
value) VALUES (?, ?, ?)} [code=3401, state=22001]
	at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:5001).

I honestly do not know where to start looking. I've seen plenty of 
StackOverflow messages about the "string data, right truncation", in 
this case AccessToken.parameters map is never touched by my code, it is 
empty. And the most confusing thing why this is even happening when I 
delete a Client with no tokens associated with it.

I suspect when the Client is deleted, given a Many to One relationship 
from ServerAccessToken to Client (but no OneToMany from Client to 
ServerAccessToken), the mapping table gets refreshed in order to find 
any tokens which may be linking to Client being deleted). But that is as 
far as I can get.

Can someone please suggest why the above might be occurring, is it a 
mapping issue, or possibly OpenJPA issue ?

Many thanks, Sergey

Mark Struberg | 25 Apr 08:30 2016

[ANNOUNCE] Welcome Francesco Chicchiriccò as Apache OpenJPA committer

Good morning!

The Apache OpenJPA PMC is happy to announce that Francesco Chicchiriccò will join the project as a new committer!

Welcome to OpenJPA, Francesco!

the OpenJPA PMC

Abhishek Bafna | 5 Apr 10:30 2016
Picon

mysql master/slave connection issue

Hi,

I am trying to setup the Mysql master/slave configuration using openjpa
datasource. Version 2.2.2
Here are the properties I am setting:

*openjpa.ConnectionProperties* =
DriverClassName=com.mysql.jdbc.ReplicationDriver,Url=jdbc:mysql:replication://master,slave/db,Username=abc,Password=123,MaxActive=10,TestOnBorrow=true,TestOnReturn=true,TestWhileIdle=true,timeBetweenEvictionRunsMillis=300000,numTestsPerEvictionRun=10*openjpa**.ConnectionDriverName*
= org.apache.commons.dbcp.BasicDataSource

From this:
http://openjpa.apache.org/builds/1.2.3/apache-openjpa/docs/ref_guide_dbsetup.html

when listed driver is a *javax.sql.DataSource*, the string will be treated
as a plugin properties string, and matched to the bean setter methods of
the *DataSource* instance.

I am using BasicDataSource. When I use the single master DB, it works fine,
But the moment I setup the master,slave host, it fails with the below
exception:
-------------------------------------------------------------------------------------
Caused by: <openjpa-2.2.2-r422266:1468616 fatal general error>
org.apache.openjpa.persistence.PersistenceException: *Cannot create
PoolableConnectionFactory (Must specify at least one slave host to connect
to for master/slave replication load-balancing functionality)*
at
org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:102)
at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:603)
at
org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1518)
at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:531)
at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:456)
at org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:120)
at
org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:967)
at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:958)
at
org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:644)
at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:203)
at
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
at org.apache.oozie.service.JPAService.getEntityManager(JPAService.java:500)
at org.apache.oozie.service.JPAService.init(JPAService.java:201)
at org.apache.oozie.service.Services.setServiceInternal(Services.java:386)
at org.apache.oozie.service.Services.setService(Services.java:372)
at org.apache.oozie.service.Services.loadServices(Services.java:305)
... 26 more
-------------------------------------------------------------------------------------

How can I solve this problem?

Thanks,
Abhishek
Francesco Chicchiriccò | 4 Apr 10:49 2016
Picon
Gravatar

UUID generators worth the effort?

Hi all,
in Syncope we are currently discussing [1] the option to replace our 
table generators-based id strategy to something else, based on UUID, 
which seem to offer several advantages.

I have found [2], but I would rather prefer to generated UUID values 
manually (via [3] which seems to offer better performance and more 
features than the standard JDK's).

In order to do so, I would replace the current

      <at> Id
     private Long id;

     public Long getKey() {
         return id;
     }

in  [4], backed by [5], with something like as

 <at> Id
private UUID id;

public UUID getKey() {
   synchronized(this) {
     if (key == null) {
       key = ... // generate via JUG [3]
     }
   }
   return key;
}

As Syncope supports several DBMSes, I would also like to empower the 
underlying capabilities for storing such values:

  * UUID Type for PostgreSQL [6]
  * UNIQUEIDENTIFIER for SQL Server [7]
  * RAW(16) for Oracle [8]
  * BINARY(16) with some optimizations for MySQL / MariaDB [9] or 
vanilla with H2

Do you have any suggestion about:

  (a) the way how I am planning to support UUID generation
  (b) the cleanest way to support DBMS differences (extending the 
respective DB dictionaries?)

TIA
Regards.

[1] http://markmail.org/message/fhdrwerdwdm3opdx
[2] 
http://openjpa.apache.org/builds/2.4.1/apache-openjpa/docs/jpa_overview_meta_field.html#jpa_overview_meta_gen
[3] https://github.com/cowtowncoder/java-uuid-generator
[4] 
https://github.com/apache/syncope/blob/master/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/user/JPAUser.java
[5] 
https://github.com/apache/syncope/blob/master/core/persistence-jpa/src/main/resources/META-INF/spring-orm.xml#L87-L94
[6] http://www.postgresql.org/docs/9.3/static/datatype-uuid.html
[7] http://wiki.ispirer.com/sqlways/sql-server/data-types/uniqueidentifier
[8] 
http://docs.oracle.com/cd/B28359_01/server.111/b28286/functions175.htm#SQLRF51816
[9] https://www.percona.com/blog/2014/12/19/store-uuid-optimized-way/

--

-- 
Francesco Chicchiriccò

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC, CXF committer
http://home.apache.org/~ilgrosso/

Mark Struberg | 3 Apr 12:56 2016

Re: Wrong order for delete of child when deleting parent

Can you please try upgrading to 2.4.1?
If you get the same issue in the newest version then it's much easier for us to reproduce.

It would also help if you could provide a sample project which at least contains the entity constellation in
question. It's much easier to discuss about such things in code than in mail ;)

txs and LieGrue,
strub

> Am 30.03.2016 um 19:33 schrieb tvogel <tvogel@...>:
> 
> The order of deletes for OpenJPA 2.3.x are happening in the wrong order and I
> can't figure out why.
> 
> Given these JPA mappings
> 
>    // grandparent
>     <at> Entity
>     <at> Table(name = "three_phase_motor_input")
>    public class ThreePhaseMotorInput implements IThreePhaseMotorInput,
> Serializable {
>         <at> Id
>         <at> GeneratedValue(strategy = GenerationType.IDENTITY)
>        private Long id;
>         <at> Version
>        private Integer version;
> 
>         <at> OneToOne(orphanRemoval = true, cascade = CascadeType.ALL, optional =
> true, targetEntity = UnapprovedThreePhaseMotor.class)
>         <at> JoinColumn(name = "unapproved_id")
>        private IThreePhaseMotor unapprovedMotor;
> 
>    // parent
>     <at> Entity
>     <at> Table(name = "unapproved_three_phase_motor")
>    public class UnapprovedThreePhaseMotor extends ThreePhaseMotor {
>         <at> OneToMany(orphanRemoval = true, cascade = CascadeType.ALL, fetch =
> FetchType.LAZY, targetEntity = UnapprovedThreePhaseWire.class)
>         <at> JoinColumn(name = "motor_id", referencedColumnName = "id", nullable =
> false)
>         <at> OrderColumn(name = "idx")
>        private List<IThreePhaseWire> wires;
> 
> 
>    // child - Abstract
>     <at> MappedSuperclass
>     <at> Access(AccessType.FIELD)
>    public abstract class ThreePhaseWire implements IThreePhaseWire,
> Serializable {
>         <at> Id
>         <at> GeneratedValue(strategy = GenerationType.IDENTITY)
>        private Long id;
> 
>    // child concrete
>     <at> Entity
>     <at> Table(name = "unapproved_three_phase_wire")
>    public class UnapprovedThreePhaseWire extends ThreePhaseWire {
> 
> 
> Order of SQL statements in log file when setting unapprovedMotor in
> grandparent to null
> 
>     572353115 UPDATE three_phase_motor_input SET status = ?, version = ?,
> approved_id = ?, unapproved_id = ? WHERE id = ? AND version = ?
> [params=(int) 1, (int) 8, (null) null, (null) null, (long) 896, (int) 7]
>     1683522521 DELETE FROM unapproved_three_phase_motor WHERE id = ? AND
> version = ? [params=(long) 209938, (int) 1]
>     446470297 DELETE FROM unapproved_three_phase_wire WHERE id = ?
> [params=(long) 1394]
> 
> This causes a foreign key constraint error since the child still exists when
> the parent delete statement is executed.
>    
> 
> 
> 
> --
> View this message in context: http://openjpa.208410.n2.nabble.com/Wrong-order-for-delete-of-child-when-deleting-parent-tp7589053.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.


Gmane