Witam, napisałem kilka klas wykorzystujący jpa do mapowania i otrzymałem błąd z którym nie mogę usunąć.
Klasa Person nadklasa dla Client i Agent zestawienie client i agent leży na klasie Profile
Person
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@SequenceGenerator(name = "sequence", sequenceName = "SEQ_MIELPA1_PERSON")
@Table(name = "PERSON")
public abstract class PersonEntity implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequence")
private int id;
private String firstName;
private String lastName;
private int pesel;
gettery i settery
Client
@Entity
@Table(name = "CLIENT")
@PrimaryKeyJoinColumn(name = "ID_CLIENT")
public class ClientEntity extends PersonEntity implements Serializable{
@OneToMany(mappedBy = "clientEntity")
private List<ProfileEntity> listProfile = new ArrayList<ProfileEntity>();
@Embedded
private Address address;
gettery i settery
Agent
@Entity
@Table(name = "AGENT")
@PrimaryKeyJoinColumn(name = "ID_AGENT")
public class AgentEntity extends PersonEntity implements Serializable{
@OneToMany(mappedBy = "agentEntity")
private List<ProfileEntity> profileList = new ArrayList<ProfileEntity>();
private int salary;
@Embedded
private Address address;
gettery i settery
Profile
@Entity
@Table(name = "PROFILE")
@SequenceGenerator(name = "sequence", sequenceName = "SEQ_MIELPA1_PROFILE")
public class ProfileEntity implements Serializable{
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequence")
private int id;
@ManyToOne
@JoinColumn(name = "ID_CLIENT")
private ClientEntity clientEntity;
@ManyToOne
@JoinColumn(name = "ID_AGENT")
private AgentEntity agentEntity;
gettery i settery
Błąd:
java.lang.RuntimeException: The persistence unit is inconsistent with the database schema: Error on entity >>com.mielpa1.model.PersonEntity<<: The Discriminator column >>PERSON.DTYPE<< does not exist. Error on entity >>com.mielpa1.model.AgentEntity<<: The Discriminator column >>PERSON.DTYPE<< does not exist. Error on entity >>com.mielpa1.model.ClientEntity<<: The Discriminator column >>PERSON.DTYPE<< does not exist.
Wydaje mi się, że przy dziedziczeniu joined nie trzeba dawać Discriminator column?
Z góry dzięki za pomoc.