Something is wrong with the JPA Inheritance and the server throws an error. There are many questions already asked on the topic, but I couldn't find a solution to my problem, so here are the details on what I have so far...
The superclass:
@Entity
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@DiscriminatorColumn(name = "PERSON_TYPE", discriminatorType = DiscriminatorType.INTEGER)
@Table(name = "PERSON")
public class Person {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TRIGGER_PERSON_PRIMARY_KEY")
@SequenceGenerator(name = "TRIGGER_PERSON_PRIMARY_KEY", sequenceName = "PERSON_AI_SEQUENCE", allocationSize = 1, initialValue = 1)
@Column(name = "PERSON_ID", updatable = false, unique = true, nullable = false)
protected int personId;
The subclass:
@Entity
@Table(name = "APPLICANT")
@DiscriminatorValue(value = "1")
@PrimaryKeyJoinColumn(name="APPLICANT_ID")
public class Applicant extends Person {
}
The error message:
The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container
Caused by: java.lang.ClassCastException: org.hibernate.mapping.UnionSubclass cannot be cast to org.hibernate.mapping.RootClass