Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Different join types, weaving and spring
Different join types, weaving and spring [message #508860] Wed, 20 January 2010 15:08 Go to next message
Matthew Pocock is currently offline Matthew PocockFriend
Messages: 18
Registered: January 2010
Junior Member
Hi,

I'm using spring 3.0 and EL 2.0 with jpa 2. Everything was going fine until I tried to map a simple class hierarchy. When I use @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) it works fine. When I use @Inheritance(strategy = InheritanceType.JOINED) it crashes with thousands of lines of exceptions, I think, because weaving is failing somehow and the implicit OneToOne that implements the join can't find the woven primary/foreign keys.

For now, I can just go with the TABLE_PER_CLASS option, but if the underlying schema is ever shared by other platforms, I would prefer to be using JOINED.

Matthew
Re: Different join types, weaving and spring [message #509155 is a reply to message #508860] Thu, 21 January 2010 14:36 Go to previous messageGo to next message
Matthew Pocock is currently offline Matthew PocockFriend
Messages: 18
Registered: January 2010
Junior Member
As a follow-up, it appears that in one case this is working for both TABLE_PER_CLASS and JOINED, and in another case it is failing for both. A typical part of the exceptions would be:

[EL Config]: 2010-01-21 14:28:55.225--ServerSession(26089635)--Connection(1690651)--Thread(Thread[main,5,main])--Connected: jdbc:postgresql://localhost/relcid
	User: relcid
	Database: PostgreSQL  Version: 8.4.2
	Driver: PostgreSQL Native Driver  Version: PostgreSQL 8.3 JDBC4 with SSL (build 603)
java.lang.NullPointerException
	at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getMethodReturnType(PrivilegedAccessHelper.java:302)
	at org.eclipse.persistence.internal.descriptors.MethodAttributeAccessor.getGetMethodReturnType(MethodAttributeAccessor.java:105)
	at org.eclipse.persistence.mappings.ForeignReferenceMapping.validateBeforeInitialization(ForeignReferenceMapping.java:1505)
	at org.eclipse.persistence.descriptors.ClassDescriptor.validateBeforeInitialization(ClassDescriptor.java:5260)
	at org.eclipse.persistence.descriptors.ClassDescriptor.preInitialize(ClassDescriptor.java:3323)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:429)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:406)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:671)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:620)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:228)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:368)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:151)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:207)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:195)
	at org.springframework.orm.jpa.JpaTransactionManager.createEntityManagerForTransaction(JpaTransactionManager.java:400)
	at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:321)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:336)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:102)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:625)
	at bioGrid.BioGRIDParser$$EnhancerByCGLIB$$3ea545ac.parseBioGRID(<generated>)
	at relnet.app.StoreBioGRID.call(StoreBioGRID.java:53)
	at spring.SpringApps.createAndRun(SpringApps.java:22)
	at relnet.app.StoreBioGRID.main(StoreBioGRID.java:26)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:110)
java.lang.NullPointerException
	at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getMethodReturnType(PrivilegedAccessHelper.java:302)
	at org.eclipse.persistence.internal.descriptors.MethodAttributeAccessor.getGetMethodReturnType(MethodAttributeAccessor.java:105)
	at org.eclipse.persistence.mappings.ForeignReferenceMapping.validateBeforeInitialization(ForeignReferenceMapping.java:1505)
	at org.eclipse.persistence.descriptors.ClassDescriptor.validateBeforeInitialization(ClassDescriptor.java:5260)
	at org.eclipse.persistence.descriptors.ClassDescriptor.preInitialize(ClassDescriptor.java:3323)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:429)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.initializeDescriptors(DatabaseSessionImpl.java:406)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.postConnectDatasource(DatabaseSessionImpl.java:671)
	at org.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:620)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:228)
	at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:368)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:151)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:207)
	at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:195)
	at org.springframework.orm.jpa.JpaTransactionManager.createEntityManagerForTransaction(JpaTransactionManager.java:400)
	at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:321)
	at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:371)
	at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:336)
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:102)
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
	at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:625)
	at bioGrid.BioGRIDParser$$EnhancerByCGLIB$$3ea545ac.parseBioGRID(<generated>)
	at relnet.app.StoreBioGRID.call(StoreBioGRID.java:53)
	at spring.SpringApps.createAndRun(SpringApps.java:22)
	at relnet.app.StoreBioGRID.main(StoreBioGRID.java:26)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:110)
[EL Severe]: 2010-01-21 14:28:55.604--ServerSession(26089635)--Thread(Thread[main,5,main])--Local Exception Stack: 
Exception [EclipseLink-0] (Eclipse Persistence Services - 2.1.0.v20091216-r6086): org.eclipse.persistence.exceptions.IntegrityException
Descriptor Exceptions: 
---------------------------------------------------------

Exception [EclipseLink-60] (Eclipse Persistence Services - 2.1.0.v20091216-r6086): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The method [_persistence_setmasterTerm_vh] or [_persistence_getmasterTerm_vh] is not defined in the object [relScore.NodeRelevanceScorer].
Internal Exception: java.lang.NoSuchMethodException: relScore.NodeRelevanceScorer._persistence_getmasterTerm_vh()
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[masterTerm]
Descriptor: RelationalDescriptor(relScore.NodeRelevanceScorer --> [DatabaseTable(NODERELEVANCESCORER)])

Exception [EclipseLink-60] (Eclipse Persistence Services - 2.1.0.v20091216-r6086): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The method [_persistence_setanns_vh] or [_persistence_getanns_vh] is not defined in the object [relScore.NodeRelevanceScorer].
Internal Exception: java.lang.NoSuchMethodException: relScore.NodeRelevanceScorer._persistence_getanns_vh()
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[anns]
Descriptor: RelationalDescriptor(relScore.NodeRelevanceScorer --> [DatabaseTable(NODERELEVANCESCORER)])

Exception [EclipseLink-60] (Eclipse Persistence Services - 2.1.0.v20091216-r6086): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: The method [_persistence_setgoldStandard_vh] or [_persistence_getgoldStandard_vh] is not defined in the object [llsScore.LlsScorer].
Internal Exception: java.lang.NoSuchMethodException: llsScore.LlsScorer._persistence_getgoldStandard_vh()
Mapping: org.eclipse.persistence.mappings.OneToOneMapping[goldStandard]
Descriptor: RelationalDescriptor(llsScore.LlsScorer --> [DatabaseTable(LLSSCORER)])

Exception [EclipseLink-41] (Eclipse Persistence Services - 2.1.0.v20091216-r6086): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: A non-read-only mapping must be defined for the sequence number field.
Descriptor: RelationalDescriptor(relScore.NodeRelevanceScorer --> [DatabaseTable(NODERELEVANCESCORER)])

Exception [EclipseLink-41] (Eclipse Persistence Services - 2.1.0.v20091216-r6086): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: A non-read-only mapping must be defined for the sequence number field.
Descriptor: RelationalDescriptor(llsScore.LlsScorer --> [DatabaseTable(LLSSCORER)])

Re: Different join types, weaving and spring [message #509208 is a reply to message #508860] Thu, 21 January 2010 16:54 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

The error seems to indicate that weaving did not occur. What is different about the two cases?

Note that Spring does not preload JPA classes to ensure that any weaving can occur before the class is load as required by JEE. This means that if your application triggers the loading of these classes before accessing the Spring context, they will fail to be weaved.

You can try using static weaving, or disabling weaving, or ensure you access the Spring context before triggering the loading of the classes.



James : Wiki : Book : Blog : Twitter
Re: Different join types, weaving and spring [message #509305 is a reply to message #508860] Thu, 21 January 2010 22:10 Go to previous messageGo to next message
Matthew Pocock is currently offline Matthew PocockFriend
Messages: 18
Registered: January 2010
Junior Member
I can see nothing different in the two cases. All objects are loaded via objects accessed through spring. The exact same configuration seems to work with hibernate.
Re: Different join types, weaving and spring [message #509871 is a reply to message #508860] Mon, 25 January 2010 16:14 Go to previous message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Well something is obviously different, my guess would be you are trigger the loading of the class before accessing the Spring context in the one that fails to weave. You can either disable weaving, use static weaving, or ensure you access you context before loading your classes.

Hibernate does not do weaving, so will not have the same issue.


James : Wiki : Book : Blog : Twitter
Previous Topic:Eclipse Link JBoss Seam query full package entity name
Next Topic:eclipselink 2.0 and weblogic 10.3.2 integration
Goto Forum:
  


Current Time: Fri Mar 29 09:09:55 GMT 2024

Powered by FUDForum. Page generated in 0.02412 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top