-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi ,
we are using hibernate for our project for that purpose we go with the zk 's session handler.
Its going good , but now we also want that the status of our last transaction(is it commited or rollback) ?
How we will get that please help.
Thanks !
@natoosandeeop
Hi natoosandeeop, what you means the status you want? For the lastest transaction?
In our zk session handler, i don't think it will save these informations, it should be design by developer.
There's a lot of way can do this, ex. log it out to a file, and check the file every time you want the
information.
/Joy
try { saveOrUpdate(aObject) tx.commit } catch (Exception e) { tx.rollback; Messagebox.show(e.toString()); }
best
Stephan
Hello Stephan(terrytornado)
I tried your code.. but it wont work.. i also want to have a rollback or commit but it seems that you cant do that in the hibernate+ZK implementation :(
here is my code example...
public class ClientDAO { Session _session; public ClientDAO() { _session = HibernateUtil.getSessionFactory().getCurrentSession(); } public void saveOrUpdate() { Object1 obj1 = new Object1(); obj1.setClientNumber("2222222"); obj1.setFirstName("Donato"); obj1.setLastName("Baonguis"); Object2 obj2 = new Object2(); obj2.setClientNumber("1111111"); obj2.setFirstName("Joy"); obj2.setFirstName("Fernandez"); Transaction tx = _session.beginTransaction(); try { _session.save(obj1); _session.save(obj2); tx.commit(); } catch(Exception e) { tx.rollback(); } } }
SEVERE: Failed to invoke class org.zkoss.zkplus.hibernate.OpenSessionInViewListener org.hibernate.TransactionException: Transaction not successfully started
Asked: 2010-01-13 00:12:40 +0800
Seen: 367 times
Last updated: Jan 17 '10