JPA 2.1 AttributeConverter autoApply option not working if converter class extends base class [message #1420693] |
Wed, 10 September 2014 06:37  |
Eclipse User |
|
|
|
I uploaded a small project that demonstrates the error. I noticed it on eclipselink 2.5.2.
The project includes a persistence unit with one entity (eclipselinktest.Entity) that contains a record (eclipselinktest.Record) that should be persisted as string using the AttributeConverter implementation (eclipselinktest.RecordConverter). The attribute converter is marked as autoApply and there's no @Convert annotation on the entity. Because of the autoApply, the converter should be applied automatically.
The persistence unit setup fails with the following error:
Internal Exception: Exception [EclipseLink-7155] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The type [class eclipselinktest.Record] for the attribute [record] on the entity class [class eclipselinktest.Entity] is not a valid type for a serialized mapping. The attribute type must implement the Serializable interface.
Now, any of these modifications to the project classes will remove the error and make test execute successfully:
1) Putting @Convert annotation to entity field that explicitely defines the record converter as "eclipselinktest.RecordConverter.class".
2) Making RecordConverter not extend BaseConverter but implement AttributeConverter directly.
It seems that eclipselink gets confused about whether it should autoApply the converter if it extends some base class.
Is this a bug? Can it be fixed?
My entities are defined using a domain specific language that get's messy quickly if lots of annotations are used, So it's useful to me to not have to define explicit @Convert annotations. Also, if my converters can extend base class I can write them more easily because I only need to define their constructor.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.24810 seconds