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...
|
|