Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

It is posible to define the persistence version attribute over a type obtained using generics?  RSS feed

 
Manuel Carnerero
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

Maybe the question itself is not very clear. I will explain it. I have some basic classes to define entities extending from them with the objetive of avoiding recoding always the same basic things. In this case I have the class:



In this class the ID and the VERSION are generic types that I can set when I define the entity class. The @version annotation alerts me that it isn't a valid type for a version attribute, but I supposed that if declare the class Person using Long class for the ID and the VERSION it should work. When I try to launch the web application in a glassfish server (4.x), it generates the error:

Caused by: Exception [EclipseLink-7168] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The attribute [curVer] of type [class java.lang.String] on the entity class [class es.nextel.libs.data.entities.ExtendedEntity] is not valid for a version property. The following types are supported: int, Integer, short, Short, long, Long, Timestamp.
at org.eclipse.persistence.exceptions.ValidationException.invalidTypeForVersionAttribute(ValidationException.java:1153)
at org.eclipse.persistence.internal.jpa.metadata.accessors.mappings.VersionAccessor.process(VersionAccessor.java:122)
at org.eclipse.persistence.internal.jpa.metadata.MetadataDescriptor.processMappingAccessors(MetadataDescriptor.java:1536)
at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.ClassAccessor.processMappingAccessors(ClassAccessor.java:1648)
at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.MappedSuperclassAccessor.processMetamodelDescriptor(MappedSuperclassAccessor.java:1219)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage2(MetadataProject.java:1784)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:576)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:585)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1869)
... 62 more

Thank you in advance and sorry about my english.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!