Community
Participate
Working Groups
The code that accumulates mappings from Annotations and XML will potentially ignore some mappings if the names and other parts of the mappings are the same. We have only seen this issue when running on WebSphere with the IBM VM. The resulting exception is something like this: Exception [EclipseLink-8030] (Eclipse Persistence Services - 2.3.2.qualifier): org.eclipse.persistence.exceptions.JPQLException Exception Description: Error compiling the query [Object.query: SELECT a.attribute FROM Object a WHERE a.attribute2 = :stuff], line 1, column 9: unknown state or association field [attribute] of class [Object]. at org.eclipse.persistence.exceptions.JPQLException.unknownAttribute(JPQLException.java:457) at org.eclipse.persistence.internal.jpa.parsing.DotNode.validate(DotNode.java:101) at org.eclipse.persistence.internal.jpa.parsing.SelectNode.validate(SelectNode.java:293) at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:201) at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:183) at org.eclipse.persistence.internal.jpa.parsing.ParseTree.validate(ParseTree.java:173) at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateReadQueryInternal(JPQLParseTree.java:110) at org.eclipse.persistence.internal.jpa.parsing.JPQLParseTree.populateQuery(JPQLParseTree.java:84) at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:219) at org.eclipse.persistence.internal.jpa.JPAQuery.processJPQLQuery(JPAQuery.java:106) at org.eclipse.persistence.internal.jpa.JPAQuery.prepare(JPAQuery.java:90) at org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(DatabaseQuery.java:613) at org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(DatabaseQuery.java:575) at org.eclipse.persistence.internal.sessions.AbstractSession.processJPAQueries(AbstractSession.java:2161) at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:442) at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:676) at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:621) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206) at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:490) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate.java:188) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:294) at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:279) at com.ibm.ws.jpa.management.JPAEMPool.getEntityManager(JPAEMPool.java:140) at com.ibm.ws.jpa.management.JPATxEntityManager.getEMInvocationInfo(JPATxEntityManager.java:235) at com.ibm.ws.jpa.management.JPAEntityManager.createNamedQuery(JPAEntityManager.java:302) at biz.wss.jpa.DbType.createNamedQuery(DbType.java:62) at biz.wss.server.services.local.dao.readers.wss.ParameterDaoEjb.readParameter(ParameterDaoEjb.java:131) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at com.ibm.ejs.container.EJSContainer.invokeProceed(EJSContainer.java:5874) at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:586) at biz.wss.server.services.logging.analysis.MethodTimerInterceptor.intercept(MethodTimerInterceptor.java:161) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227) at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:566) at com.ibm.ejs.container.interceptors.InvocationContextImpl.doAroundInvoke(InvocationContextImpl.java:217) at com.ibm.ejs.container.EJSContainer.invoke(EJSContainer.java:5766) at biz.wss.server.services.local.dao.readers.wss.EJSLocal0SLParameterDaoEjb_0aa63f49.readParameter(EJSLocal0SLParameterDaoEjb_0aa63f49.java) at biz.wss.server.services.local.fx.pricing.fotinfo.FotDAOEJB.getConfig(FotDAOEJB.java:70) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at com.ibm.ejs.container.EJSContainer.invokeProceed(EJSContainer.java:5874) at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:586) at biz.wss.server.services.logging.analysis.MethodTimerInterceptor.intercept(MethodTimerInterceptor.java:161) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227) at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:566) at com.ibm.ejs.container.interceptors.InvocationContextImpl.doAroundInvoke(InvocationContextImpl.java:217) at com.ibm.ejs.container.EJSContainer.invoke(EJSContainer.java:5766) at biz.wss.interfaces.services.fx.pricing.fotinfo.EJSLocal0SLFotDAOEJB_73eeba3d.getConfig(EJSLocal0SLFotDAOEJB_73eeba3d.java) at biz.wss.server.services.local.fx.pricing.fotinfo.FotRepository.initialise(FotRepository.java:72) at biz.wss.server.services.local.fx.pricing.fotinfo.FotInitialiser.start(FotInitialiser.java:80) at biz.wss.server.services.local.fx.pricing.fotinfo.FotInitialiser.onMessage(FotInitialiser.java:65) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at com.ibm.ejs.container.EJSContainer.invokeProceed(EJSContainer.java:5874) at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:586) at biz.wss.server.services.logging.analysis.MethodTimerInterceptor.intercept(MethodTimerInterceptor.java:161) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:611) at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor(InterceptorProxy.java:227) at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed(InvocationContextImpl.java:566) at com.ibm.ejs.container.interceptors.InvocationContextImpl.doAroundInvoke(InvocationContextImpl.java:217) at com.ibm.ejs.container.MessageEndpointHandler.invokeMdbMethod(MessageEndpointHandler.java:1080) at com.ibm.ejs.container.MessageEndpointHandler.invoke(MessageEndpointHandler.java:778) at $Proxy42.onMessage(Unknown Source) at com.ibm.ws.sib.api.jmsra.impl.JmsJcaEndpointInvokerImpl.invokeEndpoint(JmsJcaEndpointInvokerImpl.java:233) at com.ibm.ws.sib.ra.inbound.impl.SibRaDispatcher.dispatch(SibRaDispatcher.java:900) at com.ibm.ws.sib.ra.inbound.impl.SibRaSingleProcessListener$SibRaWork.run(SibRaSingleProcessListener.java:552) at com.ibm.ejs.j2c.work.WorkProxy.run(WorkProxy.java:399) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1604)
This issue occurs when we are processing the metadata and try to add so the Set that holds the list of objects. For instance: In MetadataProject we have: // Accessors that map to an Embeddable class private Set<MappingAccessor> m_embeddableMappingAccessors; public void addEmbeddableMappingAccessor(MappingAccessor accessor) { m_embeddableMappingAccessors.add(accessor); } The m_embeddableMappingAccessors list holds all the embeddable mappings for the project. We add to this set as we discover embeddable mappings. The overriden .equals() method on several parts of the MappingAccessor hierarchy does not adequately differentiate and as a result, sometimes Accessors are found to be equal when they are not actually equal - and hence not added to the set. We have observed this for Embeddeds and for OneToOnes on a large project with the same Embeddable used in many places and often with the same name. We have not been able to reproduce the issue outside of this project. The following addition to MappingAccessor.equals() appears to solve the issue on the system where we have seen the problem. if (! valuesMatch(getClassAccessor().getJavaClassName(), mappingAccessor.getClassAccessor().getJavaClassName())){ return false; } The above code checks to ensure the owning class is then same. Another possible solution is to change the datatype m_embeddableMappingAccessors and other similar collections to List.
*** Bug 362564 has been marked as a duplicate of this bug. ***
Created attachment 208060 [details] Proposed changes
Created attachment 208061 [details] Proposed changes
Changes have been submitted. Verified by: Tom Ware Tests: FullRegressionTestSuite continues to pass. Issues on websphere were verified by the customer when a new jar with this fix included was provided.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink