Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » JPA 2.1 AttributeConverter autoApply option not working if converter class extends base class
JPA 2.1 AttributeConverter autoApply option not working if converter class extends base class [message #1420693] Wed, 10 September 2014 06:37 Go to next message
Eclipse UserFriend
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.


Re: JPA 2.1 AttributeConverter autoApply option not working if converter class extends base class [message #1749490 is a reply to message #1420693] Wed, 07 December 2016 05:27 Go to previous messageGo to next message
Eclipse UserFriend
I've stumpled upon this rather old entry because I've got exactly the same problem with EclipseLink 2.6.3.
For sake of completeness, here's the link to the issue : https://bugs.eclipse.org/bugs/show_bug.cgi?id=415296
Re: JPA 2.1 AttributeConverter autoApply option not working if converter class extends base class [message #1827938 is a reply to message #1420693] Wed, 27 May 2020 05:17 Go to previous message
Eclipse UserFriend
Are there any plans to fix this bug?
Previous Topic:Static Weaving and Lifecycle Methods
Next Topic:NamedEntityGraph hint does not use table joins
Goto Forum:
  


Current Time: Tue Jul 01 14:09:28 EDT 2025

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

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

Back to the top