[hibernate-dev] can a mapped super class extends from an entity?

Emmanuel Bernard emmanuel at hibernate.org
Wed Apr 3 08:05:31 EDT 2013


AFAIR, the test is a case Linda and the JPA EG wanted covered.

On Tue 2013-04-02 11:49, Hardy Ferentschik wrote:
> Hi,
> 
> I think the code is wrong. The test setup seems correct. The spec does not really rule this case out. 
> I did not think about this case when writing the code below.
> 
> --Hardy
> 
> 
> On 2 Jan 2013, at 7:11 AM, Strong Liu <stliu at hibernate.org> wrote:
> 
> > test is org.hibernate.jpa.test.metadata.MetadataTest and root class is org.hibernate.jpa.test.metadata.Thing
> > 
> > basically here is a hierarchy like :
> > 
> > 
> > Entity ->  MappedSuperclass -> Entity -> MappedSuperclass -> Object (//not an entity but in between mapped superclass and entity) -> MappedSuperclass
> > 
> > in the metamodel branch org.hibernate.metamodel.internal.source.annotations.util.EntityHierarchyBuilder#processHierarchy
> > 
> > if ( !isEntityClass( subClassInfo ) ) {
> > 				if ( JandexHelper.containsSingleAnnotation( subClassInfo, JPADotNames.EMBEDDABLE ) ) {
> > 					throw new AnnotationException( "An embeddable cannot extend an entity: " + subClassInfo );
> > 				}
> > 				if ( JandexHelper.containsSingleAnnotation( subClassInfo, JPADotNames.MAPPED_SUPERCLASS ) ) {
> > 					throw new AnnotationException( "A mapped superclass cannot extend an entity: " + subClassInfo );
> > 				}
> > 				continue;
> > 			}
> > 
> > -------------------------
> > Best Regards,
> > 
> > Strong Liu <stliu at hibernate.org>
> > http://about.me/stliu/bio
> > 
> > 
> > 
> > _______________________________________________
> > hibernate-dev mailing list
> > hibernate-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
> 
> 
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev


More information about the hibernate-dev mailing list