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 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
Previous Topic:right way to maintain bi-directional relationships
Next Topic:EclipseLink - @OneToOne mapping does not update MongoDB(NoSQL)
Goto Forum:
  


Current Time: Mon Mar 30 14:44:33 GMT 2020

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

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

Back to the top