简体   繁体   中英

Inheritance in hibernate

I am using inheritance in hibernate, I have Table Atom, Person and Company in database . I need do this:

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
public abstract class Atom {
    ....
}

public abstract class Contact extends Atom {
    ....
}

@Entity
public class Person extends Contact {
    .......
}

@Entity
public class Company extends Contact {
    .....
}

Contact Have not table.

I can not make contact as a Entity because it has no table. I Intended place the same class annotation that Atom

@Entity
@Inheritance (strategy = InheritanceType.JOINED)
public abstract class extends Atom Contact

but search the Contact table and that table does not exis

Read these docs for more information on MappedSuperclasses:

http://docs.oracle.com/javaee/6/tutorial/doc/bnbqn.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM