-->
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: ManyToMany Unidirektional -> Exeption beim Löschen
PostPosted: Thu Dec 07, 2006 6:18 pm 
Newbie

Joined: Thu Dec 07, 2006 6:02 pm
Posts: 4
Hallo ,
ich arbeite mit JBOSS, SEAM und EBJ 3.0 und verwende dabei Hibernate Annotations.
Ich habe dort eine ManyToMany zwischen 2 Beans und möchte Insatzen beider Beans löschen können.
Bean1
Code:
@ManyToMany(targetEntity = User.class,fetch = FetchType.EAGER)
@JoinTable(name = "CFP_userprofile_contributable_map", joinColumns = @JoinColumn(name = "c_id"), inverseJoinColumns = @JoinColumn(name = "login"))
public Collection<User> getFavoriteUsers() {
      return favoriteUsers;
   }

Bean2
Code:
@ManyToMany(mappedBy = "favoriteUsers",targetEntity = Contributable.class, fetch = FetchType.EAGER)
public Collection<Contributable> getContributableFavorites() {
      if (contributableFavorites == null) {
         contributableFavorites = new ArrayList<Contributable>();
      }
      return contributableFavorites;
   }

Wenn ich nun eine Instanz von Bean1 mit
Code:
entitymanager.remove(bean1);
lösche geht das, beim löschen von bean2 bekomme ich folgende Exception:
Code:
23:12:58,859 ERROR [JDBCExceptionReporter] Cannot delete or update a parent row: a foreign key constraint fails (`jbossdb/cfp_contributable`, CONSTRAINT `FKCE4305C0FFE09684` FOREIGN KEY (`creator_login`) REFERENCES `cfp_user` (`login`))
23:12:58,859 ERROR [AbstractFlushingEventListener] Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update

Kann ich das irgendwie hinbekommen das ich bidirectional löschen kann?


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.