-->
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.  [ 3 posts ] 
Author Message
 Post subject: Can't start a cloned connection while in manual transaction
PostPosted: Thu Jan 15, 2004 5:14 pm 
Beginner
Beginner

Joined: Fri Nov 28, 2003 11:21 am
Posts: 49
Location: Buenos Aires, Argentina
Im trying to do the following:

Producto unProducto = new Producto();
Suplemento unSuplemento = new Suplemento();
Seccion unaSeccion = new Seccion();

unProducto = BossProductos.buscarProducto(1);
unSuplemento = (Suplemento)(unProducto.getSuplementos().get(0));
//unSuplemento.getSecciones().remove(0);
Seccion sec = new Seccion();
sec.setNombre("Insertada " + unSuplemento.getSecciones().size());
sec.setOrden(15);
sec.setSuplemento(unSuplemento);
sec.setBajaLogica(false);
sec.setHabilitado(true);

unSuplemento.getSecciones().add(sec);
try{
Transaction tx = GuiSGP.session.beginTransaction();
//GuiSGP.session.save(sec);
GuiSGP.session.update(unProducto);
tx.commit();
} catch (Exception E){
}

Doing this throws me the following exception:

Can't start a cloned connection while in manual transaction mode.


What's happening?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 15, 2004 5:17 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Sounds strange. Can you please show a stacktrace and some more code? What is GuiSGP ?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 16, 2004 12:08 pm 
Beginner
Beginner

Joined: Fri Nov 28, 2003 11:21 am
Posts: 49
Location: Buenos Aires, Argentina
I try to reseolve this problem by the SelectMethod property of the driver to Cursor.
The GuiSgp is just a class that instanciates a session and opens it.
The next is the relevant stacktrace:


Hibernate: select usuario0_.P_IdUsuario as P_IdUsua1_0_, usuario0_.A_Usuario as A_Usuario0_ from T_Usuario usuario0_ where usuario0_.P_IdUsuario=?
Hibernate: select tipoevento0_.P_IdTipoEvento as P_IdTipo1_, tipoevento0_.A_Nombre as A_Nombre, tipoevento0_.A_Tipo as A_Tipo from T_TipoEvento tipoevento0_
Hibernate: select producto0_.P_IdElementoEditorial as P_IdElem1_1_, producto0_.P_IdElementoEditorial as P_IdElem1_12_1_, producto0_.F_IdOrganizacion as F_IdOrga2_12_1_, producto0__1_.A_Nombre as A_Nombre11_1_, producto0__1_.A_Habilitado as A_Habili3_11_1_, producto0__1_.A_Orden as A_Orden11_1_, producto0__1_.A_BajaLogica as A_BajaLo5_11_1_, organizaci1_.P_IdOrganizacion as P_IdOrga1_0_, organizaci1_.A_RazonSocial as A_RazonS2_0_, organizaci1_.A_Predeterminada as A_Predet3_0_, organizaci1_.A_BajaLogica as A_BajaLo4_0_ from T_Producto producto0_ inner join T_ElementoEditorial producto0__1_ on producto0_.P_IdElementoEditorial=producto0__1_.P_IdElementoEditorial left outer join T_Organizacion organizaci1_ on producto0_.F_IdOrganizacion=organizaci1_.P_IdOrganizacion where producto0_.P_IdElementoEditorial=?
Hibernate: select suplemento0_.P_IdElementoEditorial as P_IdElem1___, suplemento0_.F_IdProducto as F_IdProd2___, suplemento0_.P_IdElementoEditorial as P_IdElem1_0_, suplemento0_.P_IdElementoEditorial as P_IdElem1_13_0_, suplemento0_.F_IdProducto as F_IdProd2_13_0_, suplemento0__1_.A_Nombre as A_Nombre11_0_, suplemento0__1_.A_Habilitado as A_Habili3_11_0_, suplemento0__1_.A_Orden as A_Orden11_0_, suplemento0__1_.A_BajaLogica as A_BajaLo5_11_0_ from T_Suplemento suplemento0_ inner join T_ElementoEditorial suplemento0__1_ on suplemento0_.P_IdElementoEditorial=suplemento0__1_.P_IdElementoEditorial where suplemento0_.F_IdProducto=?
Hibernate: select secciones0_.P_IdElementoEditorial as P_IdElem1___, secciones0_.F_IdSuplemento as F_IdSupl2___, secciones0_.P_IdElementoEditorial as P_IdElem1_0_, secciones0_.P_IdElementoEditorial as P_IdElem1_14_0_, secciones0_.F_IdSuplemento as F_IdSupl2_14_0_, secciones0__1_.A_Nombre as A_Nombre11_0_, secciones0__1_.A_Habilitado as A_Habili3_11_0_, secciones0__1_.A_Orden as A_Orden11_0_, secciones0__1_.A_BajaLogica as A_BajaLo5_11_0_ from T_Seccion secciones0_ inner join T_ElementoEditorial secciones0__1_ on secciones0_.P_IdElementoEditorial=secciones0__1_.P_IdElementoEditorial where secciones0_.F_IdSuplemento=?
Hibernate: update T_ElementoEditorial set A_Nombre=?, A_Habilitado=?, A_Orden=?, A_BajaLogica=? where P_IdElementoEditorial=?
Hibernate: update T_Seccion set F_IdSuplemento=? where P_IdElementoEditorial=?
Jan 16, 2004 1:04:52 PM net.sf.hibernate.StaleObjectStateException <init>
SEVERE: An operation failed due to stale data
net.sf.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect) for Productos.Seccion instance with identifier: 0
at net.sf.hibernate.persister.AbstractEntityPersister.check(AbstractEntityPersister.java:505)
at net.sf.hibernate.persister.NormalizedEntityPersister.update(NormalizedEntityPersister.java:671)
at net.sf.hibernate.persister.NormalizedEntityPersister.update(NormalizedEntityPersister.java:646)
at net.sf.hibernate.impl.ScheduledUpdate.execute(ScheduledUpdate.java:52)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2308)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2262)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2187)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)


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

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.