-->
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.  [ 2 posts ] 
Author Message
 Post subject: Is it possible to change a database without flush or commit?
PostPosted: Mon Jun 20, 2005 10:39 pm 
Newbie

Joined: Mon Jun 20, 2005 10:24 pm
Posts: 5
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

I want to insert an objet in a database, but the database changes although I'm never committing the a transaction and I'm never flushing the session. It is a big problem...

public boolean vende(Venta venta) {
session = SessionAccess.getSession();
try{
Salida salida = new Salida(new java.util.GregorianCalendar() //fecha
, String.valueOf("25") //ultimoNumero
, false //procesado
, false //contabilidad
, null //observaciones
, null //cobro
, null //bodega
, null //tipoMovimiento
, null //tipoDocumento
, null //cliente
, null //detalles
, null); //empleado

session.saveOrUpdate(salida);
SessionAccess.closeSession();
}catch(HibernateException e){
Logger.getLogger(this.getClass()).error("Error al realizar la venta: ", e);
return false;
}catch(Exception e){
;
}
SessionAccess.closeSession();
return true;
}

please, help me.

Regards

Luis


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 20, 2005 10:46 pm 
Senior
Senior

Joined: Thu May 12, 2005 11:40 pm
Posts: 125
Location: Canada
A session is automatically flushed when it is closed. If you don't want an associated instance to have its changes saved you could evict it using session.evict(), but I do not understand the purpose of calling saveOrUpdate on a newly created instance if you do not want it to be saved in the first place.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.