[jboss-user] [EJB 3.0] - Re: Anyone have SINGLE_TABLE Entity inheritance working?

itsme do-not-reply at jboss.com
Thu Jan 17 11:18:51 EST 2008


So the parents class code would look like this:

  | @Entity
  | @Table(name = "ALL_IN_ONE_TABLE")
  | @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
  | @DiscriminatorColumn(
  |         name = "CHILD_TYPE",
  |         discriminatorType = DiscriminatorType.INTEGER
  | )
  | public class ParentClass {
  | 
  |    @Id @GeneratedValue
  |    private long id;
  |    //common shared member for all children
  | }
  | 
while the childrens code look like this:

  | @Entity
  | @DiscriminatorValue("1")
  | public class FirstChildren extends Parent {
  | 
  |    //children specific member
  | 
  | }
  | 
Note that the given discriminator value is a string.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4120983#4120983

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4120983



More information about the jboss-user mailing list