Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344321 - non cacheable ManyToOne with JoinTable crashes
Summary: non cacheable ManyToOne with JoinTable crashes
Status: CLOSED 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: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-29 13:29 EDT by Constantino Cronemberger CLA
Modified: 2022-06-09 10:11 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Constantino Cronemberger CLA 2011-04-29 13:29:06 EDT
Hi,

In my application I have a legacy table that has a join table for a manyToOne relationship with another table.
Since both tables can be changed by other processes I have configured them with "@Cacheable(false)".

In the original version I was using (eclipselink-2.2.0-M5.jar) and it was working fine, but now when I tried to use version eclipselink-2.2.0.v20110202-r8913.jar it gives me the following exception:

java.lang.NullPointerException
	at org.eclipse.persistence.mappings.ObjectReferenceMapping.collectQueryParameters(ObjectReferenceMapping.java:840)
	at org.eclipse.persistence.descriptors.ClassDescriptor.postInitialize(ClassDescriptor.java:3362)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:467)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:407)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:680)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:628)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:233)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:394)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:185)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:242)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:230)
	at com.db.dbLiquidity.BaseApplicationTest.initDatabase(BaseApplicationTest.java:125)
	at com.db.dbLiquidity.BaseApplicationTest.init(BaseApplicationTest.java:161)
	at com.db.dbLiquidity.BaseApplicationTest.<init>(BaseApplicationTest.java:79)
	at com.db.dbLiquidity.Procedure.<init>(Procedure.java:17)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:202)
	at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:251)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:248)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:422)
	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:931)
	at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:785)

I have managed to create a very small entity to reproduce this problem:

@Entity
@Cacheable(false)
public class EntityA {

    private Long id;
    private EntityA entity;

    public EntityA() {
    }

    @Id
    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @ManyToOne
    @JoinTable
    public EntityA getEntity() {
        return entity;
    }

    public void setEntity(EntityA entity) {
        this.entity = entity;
    }
}

Regards,
    Constantino.
Comment 1 Tom Ware CLA 2011-05-12 15:41:17 EDT
Do you still see the same problem if you upgrade to one of our 2.3.0 milestones.  There has been some work done on cacheable in those milestones.
Comment 2 Constantino Cronemberger CLA 2011-05-13 07:09:05 EDT
(In reply to comment #1)
> Do you still see the same problem if you upgrade to one of our 2.3.0
> milestones.  There has been some work done on cacheable in those milestones.

Hi,

Using eclipselink-2.3.0.v20110429-r9282.jar I get a totally different problem. The application hangs at:

MetadataAsmFactory$MetadataMethodVisitor.visitEnd:412

To make sure this problem is not related to the ManyToOne with JoinTable issue, I have removed all JoinTables and it still hangs.

I left the application running overnight and it did not finish either.

Last log lines were:

2011-05-13 08:03:49,217 DEBUG [main] - FINEST: property=eclipselink.jpa.uppercase-column-names; default value=false - org.eclipse.persistence.session.myTest.properties
2011-05-13 08:03:49,217 DEBUG [main] - FINER: Searching for default mapping file in file:/C:/project/war/WEB-INF/classes/ - org.eclipse.persistence.session.myTest
2011-05-13 08:03:49,748 DEBUG [main] - FINER: Searching for default mapping file in file:/C:/project/war/WEB-INF/classes/ - org.eclipse.persistence.session.myTest

Regards,
   Constantino
Comment 3 Constantino Cronemberger CLA 2011-05-13 07:32:56 EDT
With version 2.3.0.v20110129-r8902 it works fine.

I will try to identify why it is hanging with the latest version.
Comment 4 Constantino Cronemberger CLA 2011-05-13 08:51:16 EDT
Using eclipselink-2.3.0.v20110429-r9282.jar it hangs because of a class with the following annotations:

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;

that is not even related to JPA in my application.

After I removed all those annotations from that class it worked.
Comment 5 Tom Ware CLA 2011-05-13 08:56:00 EDT
We have recent updated our byte-code weaver.  That is likely what is causing yoru problem.  I am targetting this bug for our 2.3.0 release.  We will do out best to address this in the next week or so.
Comment 6 Constantino Cronemberger CLA 2011-05-13 09:21:21 EDT
The class causing the problem is:

package test.jpa;

import javax.jws.WebParam;

public interface BadInterface {

    public void badMethod(@WebParam Object arg1, @WebParam Object arg2);
}

I am using static weaving.
Comment 7 Peter Krogh CLA 2011-05-13 10:26:35 EDT
I believe the the loop you are seeing is now resolved as of last nights label. The bug fix was for:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=345648

Please grab last night's build and try again.

Thanks.
Comment 9 Tom Ware CLA 2011-05-20 08:36:45 EDT
Closing... please reopen if the fix does not work for you.
Comment 10 Eclipse Webmaster CLA 2022-06-09 10:11:01 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink