openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Janko Heilgeist <>
Subject Bug/problem deserializing an enhanced class
Date Fri, 21 Sep 2007 13:57:45 GMT

I previously posted about my problem on the geronimo-user mailing list,
so some of you may have seen parts of this mail before. Thanks to the
help of David Jencks and Jarek Gabor I was able to isolate the core of
my problem and write a unit-test for OpenJPA (see attachment).

In my code I derive an entity from an interface, that uses generics:

public interface GenericEntity<PK extends Serializable> {
	PK getEntityId();
	void setEntityId();

public interface LongObjIdEntity extends GenericEntity<Long> {

public class SomeEntity implements LongObjIdEntity, Serializable {
	private Long entityId;

	Long getEntityId() {
		return entityId;
	void setEntityId(Long entityId) {
		this.entityId = entityId;

The enhancement process of OpenJPA seems to scramble the class somehow,
so that serialized objects can no longer be deserialized. More exactly
the call


somewhere inside the computation of the serialVersionUID inside the
ObjectOutputStream.readObject() method fails with a VerifyError. This
only happens if the @Id @GeneratedValue annotations are applied to the
getter/setter for PROPERTY-access (or instead of annotations the orm.xml
contains the access-type="PROPERTY" attribute). FIELD-access produces no
problems at all.

The attached unit-test contains tests for both cases and PROPERTY-access
fails reliably with release 1.0.0 and the current SVN-version of
OpenJPA. The stacktrace is:

java.lang.VerifyError: (class:
method: getEntityId signature: ()Ljava/lang/Long;) Wrong return type in
	at java.lang.Class.getDeclaredFields0(Native Method)
	at java.lang.Class.privateGetDeclaredFields(
	at java.lang.Class.getDeclaredField(

Regards, Janko

View raw message