Hello, I have two hierarchies A and B where SubB1 will be related with SubA1 and SubB2 with SubA2:
Code:
@Entity
public abstract class ClassA{(...)}
@Entity
public class SubA1(){(...)}
@Entity
public class SubA2(){(...)}
Code:
@Entity
public abstract class ClassB{
(...)
protected ClassA myA;
@ManyToOne()
@Foreign(name="B_A")
public ClassA getMyA(){...}
(...)
}
@Entity
public class SubB1{
(...)
@Transient
public SubA1 getMyA(){
return (SubA1)myA;
}
(...)
}
@Entity
public class SubB2{
(...)
@Transient
public SubA2 getMyA(){
return (SubA2)myA;
}
(...)
}
When I create a B object and persist it it works correctly, the problem is when I load it back. Hibernate throws a org.hibernate.WrongClassException
Could any one help me??
Regards,
Chiara