]
Daniel Dyer commented on HHH-3008:
----------------------------------
Not sure if this is of interest, but while I was searching for information about this
problem, I came across a similar issue in Glassfish (TopLink):
Cascade delete does not work with unidirectional @OneToMany and
@JoinTable
--------------------------------------------------------------------------
Key: HHH-3008
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3008
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.5
Environment: Standalone entity manager (JavaSE 5.0).
H2 database.
Reporter: Daniel Dyer
A unidirectional one-to-many relationship defined as follows:
public class Owner
{
@OneToMany(cascade = CascadeType.ALL)
@JoinTable(name = "owner_element",
joinColumns = @JoinColumn(name = "owner_id",
nullable = false,
updatable = false),
inverseJoinColumns = @JoinColumn(name = "element_id",
nullable = false,
updatable = false))
private List<Element> elements;
// ...
}
Attempting to delete an instance of Owner should also delete all associated instances of
Element. Instead I get the following error:
SEVERE: Referential integrity constraint violation: FK56BBF9C487E817D:
PUBLIC.OWNER_ELEMENT FOREIGN KEY(OWNER_ID) REFERENCES PUBLIC.OWNER(ID) [23003-63]
This is because Hibernate attempts to delete the Owner row without first removing the
rows from the join table.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: