En passant en pas a pas dans le code Hibernate, j'ai trouve ce qui ne fonctionnait pas
Main class:
@Entity @DiscriminatorColumn(name = "tag", discriminatorType = DiscriminatorType.STRING) @Inheritance(strategy = InheritanceType.JOINED) @Table(name = "InfoGroups", uniqueConstraints = @UniqueConstraint(columnNames = {"is_active", "journal_id", "name", "version", "infogroup_release"})) @XmlRootElement(name = "PkgGroup") public class InfoGroup implements Serializable {
... }
for discriminant only inheritence
@Entity @DiscriminatorValue("MovieInfo") public class MovieInfo extends InfoGroup implements Serializable { ... }
and for joined and discriminant inheritence
@Entity @DiscriminatorValue("SpecialInfo") @PrimaryKeyJoinColumn(name="db_id") @Table(name = "Specials") public class SpecialInfo extends InfoGroup implements Serializable { ... }
do not try to specify the table for discriminant only inherience else you'll run into hibernate exception at runtime
|