Hi All,
I am trying Exercise no 8.2 from the book Enterprise Javabeans 3.0(Oreilly). I encountered a weird behaviour . I cannot assign @Generated Value to the primary key of my Super Class while implementing
the InheritenceType.TABLE_PER_CLASS mappings.
package com.titan.domain;
import javax.persistence.*;
@Entity
@Inheritance
(strategy = InheritanceType.
TABLE_PER_CLASS)
public class Person implements java.io.Serializable
{
private int id;
private
String firstName;
private String lastName;
@Id
@GeneratedValue //this is giving an error.
public int getId() { return id; }
public void setId(int id) { this.id = id; }
package com.titan.domain;
import javax.persistence.*;
@Entity
public class Customer extends Person
{......}
package com.titan.domain;
import javax.persistence.*;
@Entity
public class Employee extends Customer
{......}
While the Primary key Autogeneration works for InheritanceType. JOINED and InhertitanceType.
SINGLE_CLASS, its giving me an error for the same in InheritenceType. TABLE_PER_CLASS.
Any Idea?