Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 365623 - Mappings are potentially ignored by metadata processing
Summary: Mappings are potentially ignored by metadata processing
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 362564 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-12-05 10:57 EST by Tom Ware CLA
Modified: 2022-06-09 10:24 EDT (History)
3 users (show)

See Also:


Attachments
Proposed changes (14.40 KB, patch)
2011-12-07 13:29 EST, Guy Pelletier CLA
no flags Details | Diff
Proposed changes (13.99 KB, patch)
2011-12-07 13:40 EST, Guy Pelletier CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Ware CLA 2011-12-05 10:57:20 EST
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)
Comment 1 Tom Ware CLA 2011-12-05 11:16:30 EST
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.
Comment 2 Tom Ware CLA 2011-12-05 11:48:22 EST
*** Bug 362564 has been marked as a duplicate of this bug. ***
Comment 3 Guy Pelletier CLA 2011-12-07 13:29:03 EST
Created attachment 208060 [details]
Proposed changes
Comment 4 Guy Pelletier CLA 2011-12-07 13:40:26 EST
Created attachment 208061 [details]
Proposed changes
Comment 5 Guy Pelletier CLA 2011-12-08 08:21:38 EST
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.
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:24:08 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink