On Mar 14, 2012, at 9:17 PM, Steve Ebersole wrote:

> Can someone help me understand whether this is valid annotation mapping:
> 
> @Entity
> class A {
> }
> 
> @Entity
> class B extends A {
> }

That's valid. The @Inheritance annotation is optional. If not specified 
InheritanceType.SINGLE_TABLE is used.

> My understanding was that an @Entity extending an @Entity had to specify 
> an inheritance strategy?  And that this example is really the point of 
> @MappedSuperclass:
> 
> @MappedSuperclass
> class A {
> }
> 
> @Entity
> class B extends A {
> }

Citing from the spec here:

An entity may inherit from a superclass that provides persistent entity state 
and mapping information,
but which is not itself an entity. Typically, the purpose of such a mapped 
superclass is to define state
and mapping information that is common to multiple entity classes.

--Hardy
_______________________________________________
hibernate-dev mailing list
hibernate-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/hibernate-dev

Reply via email to