Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 12th, 2012  |  syntax: None  |  size: 0.45 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. EclipseLink JPA Inheritance Decision
  2. @Entity
  3. @Table(name="Person")
  4. @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
  5. @DiscriminatorColumn(name="TYPE", discriminatorType=DiscriminatorType.STRING,length=20)
  6. @DiscriminatorValue("P")
  7. public class Person{
  8.  
  9.     @Id
  10.     protected BigInteger id;
  11.     protected String FirstName;
  12.     ...
  13. }
  14.  
  15. @Entity
  16. @DiscriminatorValue("S")
  17. public class Student extends Person{
  18.  
  19.     protected Integer YearInSchool;
  20.     ...
  21. }