-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: unidirectional ManyToMany integrity
PostPosted: Thu Feb 02, 2012 5:48 am 
Newbie

Joined: Tue Jan 31, 2012 3:44 pm
Posts: 7
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 :)


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.