[hibernate-dev] Why must abstract be specified in mappings?

Emmanuel Bernard emmanuel at hibernate.org
Tue Nov 25 03:29:41 EST 2014


This is a user related question that should go on our forums https://forums.hibernate.org <https://forums.hibernate.org/>

But to answer you, you sometimes want to have a physical table for that abstract class. So Hibernate ORM’s “abstract” really means map it to a table or not. Java’s abstract has a different meaning, it means must be subclassed or not. Mapping both together does not really work.

Could you propose a small pull request that clarifies this in the documentation ?

Emmanuel

> On 24 Nov 2014, at 11:58, Oskar Berggren <oskar.berggren at gmail.com> wrote:
> 
> Hi,
> 
> The Hibernate documentation (section 10.1.5. Table per concrete class
> http://docs.jboss.org/hibernate/orm/4.3/manual/en-US/html/ch10.html#inheritance-tableperconcrete
> ) says:
> 
>> If your superclass is abstract, map it with abstract="true". If it is not
> abstract,
>> an additional table (it defaults to PAYMENT in the example above), is
> needed
>> to hold instances of the superclass.
> 
> Why is this keyword needed? Couldn't abstract classes be detected
> automatically using reflection?
> 
> 
> /Oskar
> _______________________________________________
> 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