openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Dick" <michael.d.d...@gmail.com>
Subject MappedSuperclasses
Date Wed, 09 Aug 2006 18:30:43 GMT
Can a MappedSuperclass extend an Entity?

I've run into a problem during validation of a MappedSuperclass.  I have an
abstract class (AbstractEmployee) with the @Entity and @Id annotations. The
MappedSuperclass (AbstractFullTimeEmployee) extends it.  Finally a concrete
entity class (FulltimeExemptEmployee) extends the MappedSuperclass.

When the OpenJPA kernel validates the concrete class I get a warning like
this  :
2740  WARN   [main] openjpa.Enhance - An exception was thrown while
attempting to perform class file transformation on
"mdd/entities/FullTimeExemptEmployee":
<4|true|0.9.0> org.apache.openjpa.util.MetaDataException: Type "class
mdd.entities.AbstractFullTimeEmployee" does not declare the same
identity-type as its persistent superclass.
    at org.apache.openjpa.meta.ClassMetaData.validateIdentity(
ClassMetaData.java:1642)
    . . .

The identity type for MappedSuperclasses is set to ClassMetaData.ID_UNKNOWNin
AnnotationPersistenceMetaDataParser.parseClassAnnotations(). Which seems to
ensure that the identity type for a MappedSuperclass will never match the id
type for its superclass (whenever the superclass has an ID).

I don't see anything in the the spec that prevents this scenario, should
this be valid?  I know my example isn't the best, but I hope it at least
helps to illustrate the issue.

Thanks,
-- 
-Michael Dick

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message