Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » AbstractMethodError: _persistence_shallow_clone()
AbstractMethodError: _persistence_shallow_clone() [message #1067596] Tue, 09 July 2013 09:58 Go to next message
Eclipse UserFriend
Hi all,

I'm trying to use single table inheritance to store 3 different classes (B,C and D) than inherit from the same base class (A). Please see the class definitions below.
Using version 2.4.2, I think I followed the instructions as described here: http://wiki.eclipse.org/EclipseLink/Examples/JPA/Inheritance#Annotations

For unit testing, this is the part of the script that fills the table:

INSERT INTO A (id, dtype, ...) VALUES 
	(1, 'A', ...),
	(2, 'B', ...),
	(3, 'C', ...),
	(4, 'D', ...);


package model;

@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
// @Table(name = "A")
// @DiscriminatorColumn(name = "clztype", discriminatorType = DiscriminatorType.STRING, length = 1)
// @DiscriminatorValue("A")
public class A {

	@Id
	@SequenceGenerator(name = "ASEQ", sequenceName = "ASEQUENCE", allocationSize = 1)
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "ASEQ")
	protected Long id;

	...
}


package model;

@Entity
// @DiscriminatorValue("B")
public class B extends AuthenticationBlock {

}


package model;

@Entity
// @DiscriminatorValue("C")
public class C extends A {

}


package model;

@Entity
// @DiscriminatorValue("D")
public class D extends A {

}



When loading a list, I get:

java.lang.AbstractMethodError: model.C._persistence_shallow_clone()Ljava/lang/Object;
		at org.eclipse.persistence.descriptors.copying.PersistenceEntityCopyPolicy.buildClone(PersistenceEntityCopyPolicy.java:35)
		at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildBackupClone(ObjectBuilder.java:483)
		at org.eclipse.persistence.descriptors.changetracking.DeferredChangeDetectionPolicy.buildBackupClone(DeferredChangeDetectionPolicy.java:225)
		at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildWorkingCopyCloneFromRow(ObjectBuilder.java:1774)
		at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObjectInUnitOfWork(ObjectBuilder.java:672)
		at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:609)
		at org.eclipse.persistence.internal.descriptors.ObjectBuilder.buildObject(ObjectBuilder.java:564)
		at org.eclipse.persistence.queries.ObjectLevelReadQuery.buildObject(ObjectLevelReadQuery.java:777)
		at org.eclipse.persistence.queries.ReadAllQuery.registerResultInUnitOfWork(ReadAllQuery.java:797)
		at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:434)
		at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1150)
		at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:852)
		at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1109)
		at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:393)
		at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1197)
		at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2879)
		at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1607)
		at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1589)
		at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1554)
		at org.eclipse.persistence.internal.jpa.QueryImpl.executeReadQuery(QueryImpl.java:231)
		at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:411)
		at org.springframework.data.jpa.repository.support.SimpleJpaRepository.findAll(SimpleJpaRepository.java:247)
		at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
		at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
		at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
		at java.lang.reflect.Method.invoke(Method.java:601)
		at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.executeMethodOn(RepositoryFactorySupport.java:333)
		at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:318)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
		at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
		at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
		at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
		at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:155)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
		at org.springframework.data.jpa.repository.support.LockModeRepositoryPostProcessor$LockModePopulatingMethodIntercceptor.invoke(LockModeRepositoryPostProcessor.java:92)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
		at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
		at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
		at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
		at com.sun.proxy.$Proxy59.findAll(Unknown Source)


Moreover, A and B seem to load fine and do not use the _persistence_shallow_clone() method at all (I set a breakpoint at line 35 of the org.eclipse.persistence.descriptors.copying.PersistenceEntityCopyPolicy.buildClone method).
It's only C and D dat give problems. Anyone got a clue?

TIA,
Ronald

Re: AbstractMethodError: _persistence_shallow_clone() [message #1067617 is a reply to message #1067596] Tue, 09 July 2013 11:11 Go to previous messageGo to next message
Eclipse UserFriend
B seems to be extending AuthenticationBlock not the A entity you mentioned in the post, so I don't see how it could get loaded when reading from table A - just a copy+paste error?

The _persistence_shallow_clone() should get added when it is woven to implement the PersistenceObject and other interfaces, but I dont know enough of Spring to tell what might be going wrong. How did you set up weaving for your entities, how are they packaged, and what query are you executing? You might try specific em.find(A.class, 1); em.find(C.class, 3); calls and check the logs for configuration warnings and the SQL that is generated using EclipseLink's Finest level of logging: http://wiki.eclipse.org/EclipseLink/Examples/JPA/Logging and try static weaving http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance/Weaving/Static_Weaving to see if it helps. Static weaving will also give you the class files so you can see where it might be going wrong.

Best Regards,
Chris
Re: AbstractMethodError: _persistence_shallow_clone() [message #1067654 is a reply to message #1067617] Tue, 09 July 2013 16:04 Go to previous messageGo to next message
Eclipse UserFriend
Ah, quick copy/paste type. B extends an authenticationBlock which should be renamed to A.
For clarity I just renamed it A in the code here but I didn't do it everywhere appearantly. Sorry to confuse.

I'm using eclipse Juno with WTP to run Tomcat 7. Thx for pointing out the static weaving option.
I'll see if I can get that to work tomorrow.

Ronald
Re: AbstractMethodError: _persistence_shallow_clone() [message #1068015 is a reply to message #1067654] Thu, 11 July 2013 12:44 Go to previous message
Eclipse UserFriend
Hi,

Seems like this is the issue:
http://forum.springsource.org/showthread.php?89558-Entity-not-woven-if-classloaded-before-LocalContainerEntityManagerFactoryBean-init

The is not woven because it's loaded before the LocalContainerEntityManagerFactoryBean has been inited.
My unit test doesn't work, but the application in Tomcat works fine.

Ronald
Previous Topic:Schema creation slow with informix
Next Topic:Many Warnings from JPA-Added RowIDs When Database Change Notification Enabled
Goto Forum:
  


Current Time: Thu May 22 13:21:53 EDT 2025

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

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

Back to the top