openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Broadhead <>
Subject @Converter @Strategy @Externalizer @Factory multiple fail?
Date Thu, 14 Sep 2017 22:26:44 GMT
i am using TomEE 7.0.3 which ships with OpenJPA 2.4.2.  the database is 

i want to store a String (MySQL text column) in the database but use 
JAXB to marshal and unmarshal the POJOs.  the main class is annotated 
with @XmlRootElement. it is also serializable, as are the children objects.

i tried to use javax.persistence.Converter specifically 
javax.persistence.AttributeConverter but it just gives
org.apache.openjpa.persistence.ArgumentException - No registered 
metadata for type "class". This can happen if 
this class has not been annotated as a persistent entity or specified in 
the persistence unit (ex: in the orm.xml).
i had the class listed in the persistence.xml.  maybe 2.4.2 is only JPA 2.0?

then i found this article

and tried Romain's suggestion using @Externalizer and @Factory 
(org.apache.openjpa.persistence.Externalizer and 
org.apache.openjpa.persistence.Factory).  This results in
Caused by: invalid stream header: 
3C71756F.  with and without @Persistent annotating the field

at the bottom of the article i found Struberg's suggestion


this loads the POJO correctly but fails to commit the object back to the 
database during em.merge and em.persist.  there is a gist here

FYI i am using the deltaspike 1.8.0 @Transactional 
org.apache.deltaspike.jpa.api.transaction.Transactional to wrap the 
transactions in case that might be interfering.

View raw message