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: using row lock with datasource on IBM was 6.1
PostPosted: Thu Mar 26, 2009 7:29 pm 
Newbie

Joined: Mon Feb 23, 2009 10:59 am
Posts: 1
Location: Managua,Nicaragua
i'm trying to use row lock on ass400 tables and i'm using a datasource that is on IBM WAS 6.1 to connect to the iseries.

what i want to do is to lock the row (select for update) and keep it locked while i'm editing the row.

This is the code i'm using to select the row
------------------------------------------------
Session session = HibernateUtil.getSessionFactoryENS().getCurrentSession();
Transaction tx = null;
Aplicacion aplicacion = null;

tx = session.getTransaction();
if(tx == null || !tx.isActive()){
tx = session.beginTransaction();
}

aplicacion = (Aplicacion) session.get(Aplicacion.class, sCodApp, LockMode.UPGRADE);
------------------------------------------------------------
but whenever i open another transaction the lock is released and the operation is rolled back.

so, if another user tries to edit the same row at this point, the row won't be locked.

So is there any way to keep the transaction open until i call the update method.

Any help is more than welcome.


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.