Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 10:37 Go to next message
Miljan Markovic is currently offline Miljan MarkovicFriend
Messages: 1
Registered: September 2014
Junior Member
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 10:27 Go to previous messageGo to next message
Robin Sander is currently offline Robin SanderFriend
Messages: 1
Registered: December 2016
Junior Member
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 09:17 Go to previous message
Jan Ortmann is currently offline Jan OrtmannFriend
Messages: 6
Registered: July 2009
Junior Member
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 Mar 19 11:34:10 GMT 2024

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

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

Back to the top