I have the following AnyObject. If I set details to this object all works fine. But if i try to delete the details, I'm able to set the details to null. But the details entry in database is not deleted.
Somebody can tell me why?
Thank you. :-)
@Entity
@Table(name="ANY_OBJECT")
public class AnyObjects extends Abstract Entity{
private String anyProp;
private AnyObjectDetails details;
//Getter
@ManyToOne(cascade=CascadeType.PERSIST)
@JoinColumn(name="DETAILS_ID")
public AnyObjectsDetails getDetails(){
return details;
}
//...
}
public class AnyObjectController{
//...
anyObjectDetailsRepository.delete(anyObject.getDetails());
anyObject.setDetails(null);
//...
}
Please check the Documentation here. you may want to change the CascadeType to CascadeType.ALL. This should work.