Hello, I have something like this:
Code:
public abstract class MyClass<E extends MyAbstractEntity> implements Serializable{
private static final long serialVersionUID = 2832228828007049949L;
private Long id;
protected E myEntity;
@Id @GeneratedValue(strategy=GenerationType.IDENTITY)
public Long getId() {
return id;
}
@SuppressWarnings("unused")
private void setId(Long id) {
this.id = id;
}
@OneToOne(fetch=FetchType.LAZY,cascade=CascadeType.ALL)
public E getMyEntity() {
return myEntity;
}
@SuppressWarnings("unused")
private void setMyEntity(M myEntity) {
this.myEntity = myEntity;
}
}
public class MyEspecificClass extends MyClass<MyEspecificEntity>{
private static final long serialVersionUID = 6451465817583035678L;
...Some specific methods...
}
the problem here is that when I persist a myEspecificClass object, Hibernate doesn't persist the myEspecificEntity with the correct class.
Could anyone help me?
Have anyone done something like that in the past?
Regards,
Chiara