Hi Luis,

This is related to a "fix" for another bug around OpenJPA and temporary classloaders required for OpenJPA's dynamic byte code enhancing. I use fix in quotes because it's one of those situations where none of the solutions are perfect and each has it's own drawbacks. For your 3.1.1 install you can set this flag as so which should allow OpenJPA to see the annotation again:

  openejb.tempclassloader.skip=annotations

In the current 3.1.2 code you should be able to run without that flag set.

-David


On Jul 23, 2009, at 10:37 AM, Luis Fernando Planella Gonzalez wrote:

Hi all.
I've upgraded to OpenEJB 3.1.1, and having an issue with mappings using OpenJPA specific annotations, such as @Persistent to persist an InputStream as blob. The strange part is that I was already using OpenJPA 1.2.1 with OpenEJB 3.1.0, and without problems. If I revert to this version, everything works ok. Previously I had the same problem when I accidentally left the openjpa-XXX.jar file in WEB-INF/lib (thus @Persistent was defined in 2 separate classloaders, the global and the web-app specific, which caused problems). That's not the case now.

The exception root cause:

Caused by: <openjpa-1.2.0-r422266:683325 fatal user error> org.apache.openjpa.persistence.ArgumentException: Embedded property "nl.strohalm.cyclos.entities.customization.images.Image.image" declares a mapping override for "contents", but that is not a persistent property in the embedded type. at org .apache .openjpa .persistence .jdbc .AnnotationPersistenceMappingParser .parseAttributeOverrides(AnnotationPersistenceMappingParser.java:1208) at org .apache .openjpa .persistence .jdbc .AnnotationPersistenceMappingParser .parseMemberMappingAnnotations (AnnotationPersistenceMappingParser.java:962) at org .apache .openjpa .persistence .AnnotationPersistenceMetaDataParser .parseClassAnnotations(AnnotationPersistenceMetaDataParser.java:622) at org .apache .openjpa .persistence .AnnotationPersistenceMetaDataParser .parse(AnnotationPersistenceMetaDataParser.java:352) at org .apache .openjpa .persistence .PersistenceMetaDataFactory.load(PersistenceMetaDataFactory.java:229) at org .apache .openjpa .meta.MetaDataRepository.getMetaDataInternal(MetaDataRepository.java: 474) at org .apache .openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java: 294) at org .apache .openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepository.java: 581) at org .apache .openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:541) at org .apache .openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java: 308) at org .apache .openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepository.java: 581) at org .apache .openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:541) at org .apache .openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java: 308) at org .apache .openjpa .meta.ValueMetaDataImpl.resolveDeclaredType(ValueMetaDataImpl.java: 431) at org .apache .openjpa.meta.ValueMetaDataImpl.resolve(ValueMetaDataImpl.java:410) at org .apache .openjpa.jdbc.meta.ValueMappingImpl.resolve(ValueMappingImpl.java:470) at org.apache.openjpa.meta.FieldMetaData.resolve(FieldMetaData.java: 1676) at org.apache.openjpa.jdbc.meta.FieldMapping.resolve(FieldMapping.java: 416) at org.apache.openjpa.meta.ClassMetaData.resolveMeta(ClassMetaData.java: 1689) at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java: 1624) at org .apache .openjpa .meta.MetaDataRepository.processBuffer(MetaDataRepository.java:717) at org .apache .openjpa.meta.MetaDataRepository.resolveMeta(MetaDataRepository.java: 616) at org .apache .openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:541)
        ... 65 more


The involved classes:

@MappedSuperclass
public abstract class Image extends BaseEntity {

   @Embedded
   @AttributeOverrides({
@AttributeOverride(name = "height", column = @Column(name = "thumbnail_height")), @AttributeOverride(name = "width", column = @Column(name = "thumbnail_width")), @AttributeOverride(name = "length", column = @Column(name = "thumbnail_length")), @AttributeOverride(name = "contents", column = @Column(name = "thumbnail_contents"))
   })
   private ImageData thumbnail;

   @Embedded
   @AttributeOverrides({
@AttributeOverride(name = "height", column = @Column(name = "image_height")), @AttributeOverride(name = "width", column = @Column(name = "image_width")), @AttributeOverride(name = "length", column = @Column(name = "image_length")), @AttributeOverride(name = "contents", column = @Column(name = "image_contents", columnDefinition = "mediumblob"))
   })
   private ImageData image;

   ...
}

@Embeddable
public class ImageData {

   @Basic(optional = false)
   private Integer     height;

   @Basic(optional = false)
   private Integer     width;

   @Basic(optional = false)
   private Integer     length;

   @Lob
   @Persistent(optional = false, fetch = FetchType.LAZY)
   private InputStream contents;

   ...
}

Can anybody help?


Reply via email to