Hi,
I have the entity classes Fortbildun and Evaluation
Evaluation has a Collection of Fortbildung
Code:
@Entity
class Evaluation {
...
@ManyToMany
@JoinTable( name = "fortbildung_evaluation",
joinColumns = { @JoinColumn( name = "evaluation_id" )},
inverseJoinColumns = { @JoinColumn( name = "fortbildung_id" )} )
public List<Fortbildung> getFortbildungen() {
return fortbildungen;
}
...
}
Fortbildung is not aware of this relationship.
My problem is, as soon as I try to delete an Fortbildung entity that is in a Collection of an Evaluation entity I get an Exception with the following root cause:
Quote:
...
Caused by: java.sql.BatchUpdateException: integrity constraint violation: foreign key no action; FK42D220F7459961BF table: FORTBILDUNG_EVALUATION
at org.hsqldb.jdbc.JDBCPreparedStatement.executeBatch(Unknown Source)
at org.apache.commons.dbcp.DelegatingStatement.executeBatch(DelegatingStatement.java:297)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
... 53 more
I had a look at cascading, but as far as I understand this only effects changes from Evaluation side. I could not find anything on this, especially including the case that one side of the relationship does not know of the other side.
So what do I have to do to get the reference deleted from th collection within the Evaluation entity as soon as I delete the Fortbildung entity?
btw: we, so far, only use annotated entity classes an have no xml configuration on hibernate concerning entity persistence.
thanks so far :)