-->
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: Many-to-Many delete...
PostPosted: Wed Sep 17, 2003 6:27 pm 
Newbie

Joined: Wed Sep 17, 2003 1:38 pm
Posts: 1
I can't delete a relationship...

My code is this...

<set name="proyectos" table="ProyectoCategoria" inverse="true">
<key column="idCategoria"/>
<many-to-many class="com.tsawi.pm.pojo.Proyecto"
column="idProyecto"/>
</set>

And...

<set name="categorias" table="proyectocategoria">
<key column="idProyecto"/>
<many-to-many class="com.tsawi.pm.pojo.Categoria"
column="idCategoria"/>
</set>

The method that delete the relationship is...

beginSession();
proyecto = (Proyecto)session.load(Proyecto.class, idProyecto);
categoria = categoriaBO.obtenerCategoria(idCategoria);
Set sCategorias = proyecto.getCategorias();
sCategorias.remove(categoria);
proyecto.setCategorias(sCategorias);
session.update(categoria);
session.flush();

But I have a error

net.sf.hibernate.HibernateException: Another object was associated with this id (the object with the given id was already loaded): [com.tsawi.pm.pojo.Categoria#1]

I need help...please...


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.