0

I'm using inheritence with JPA and HIBERNATE so i have these entities :

@Entity
@Inheritance( strategy = InheritanceType.SINGLE_TABLE )
@DiscriminatorColumn( name = "entityType", 
        discriminatorType = DiscriminatorType.STRING )
public abstract class A implements Serializable
{
    @Id
    private String id;
    @ManyToOne
    @JoinColumn(name = "Z_ID", nullable = false)
    private Z z;

    // other mapped properties...
}

@Entity
@DiscriminatorValue("BB")
public class BB extends A
{
    @Basic( optional = false)
    @Column( table = "BB" )
    private String property1;

    // other mapped properties and associations...
}

@Entity
@DiscriminatorValue("CC")
public class CC extends A
{
    @ManyToOne( optional = false)
    @JoinColumn( table = "CC" )
    private SomeEntity association1;

    // other mapped properties and associations...
}
public class Z implements Serializable
{
    @Id
    private String id;
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "z", cascade= CascadeType.ALL, orphanRemoval=true)
    private Set<A> as;

    // other mapped properties...
}

I know that i can add two attributes bb and cc in the entity Z but have many other entities inheritence from A so i ask if there any solution to only one attribute z. The implementation above gave me an exception :

org.hibernate.exception.GenericJDBCException: Could not read entity state from ResultSet

This is the hole exception as images Exception part 1 Exception part 2 Exception part 3

Sidaoui Majdi
  • 399
  • 7
  • 26
  • When asking about an exception, always post the exact and complete stac trace of the exception, and the relevant code. – JB Nizet Jul 12 '19 at 09:18
  • 1
    Nest time, post it as text, not as images. As the last part shows, your problem has nothing to do with inheritance. It has to do with some invalid date that can't be parsed.. – JB Nizet Jul 12 '19 at 10:01

0 Answers0