I have a JPA @Entity 'RecipestepBO' which uses a @Converter:
@Entity
@Converter( name="UnitConverter", converterClass=com.lemcke.share.recipe.Unit.class )
@Table(name = "recipestep")
public class RecipestepBO {
...
private Unit rpsunit = null;
...
@Column( name="rpsunit" )
@Convert( "UnitConverter" )
public Unit getRpsunit() { return rpsunit; }
...
}
And the converter class (which is in fact an enumeration) in the same package:
package com.lemcke.share.recipe;
public enum Unit implements Converter {
Liter ( "l" )
....
all overloaded methods from the Converter
....
}
Starting the application results in the following EclipseLink exception:
Exception in thread "main" javax.persistence.PersistenceException: Exception [EclipseLink-28019] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.EntityManagerSetupException Exception Description: Deployment of PersistenceUnit [testPU] failed. Close all factories for this PersistenceUnit. Internal Exception: Exception [EclipseLink-7198] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.ValidationException Exception Description: Class: [com.lemcke.share.recipe.Unit] was not found while converting from class names to classes.
The entity is written in the persistence.xml file. The converter 'Unit' is not (because its not an entity).
What am I doing wrong?