This issue can't be edited

Because it belongs to an archived project. Jira admins can restore projects from the archive.

hold lock during statement "select for Update"

Description

You see this program:

session = sf.openSession();
tx = session.beginTransaction();
Menu m = new Menu();
// lock record for update
Menu menu = (Menu) session.load(m.getClass(),(Serializable) new BigDecimal(1029), LockMode.UPGRADE);
menu.setName("New Item");
// you do something...
Thread.sleep(10000);
// Update and Unlock record
session.update(menu);

but the record 1029 not hold lock in dataBase, during the delay, becuase, I think you close "PreparedStatement" and then you lose the lock.

Can I hold lock during time delay?

thanks!

Environment

Hibernate 2.1.6, Database DB400, java 1.4.2

Activity

Show:

CVS Notification ServiceOctober 26, 2004 at 6:36 PM

CVS COMMIT LOG:
SUBJECT: [Hibernate-commits] Hibernate3/src/org/hibernate/sql ForUpdateFragment.java,1.3,1.4 Select.java,1.6,1.7 SimpleSelect.java,1.3,1.4
fixed HB-1194, use with rr in DB2

CVS Notification ServiceOctober 26, 2004 at 6:36 PM

CVS COMMIT LOG:
SUBJECT: [Hibernate-commits] Hibernate3/src/org/hibernate/id TableGenerator.java,1.7,1.8
fixed HB-1194, use with rr in DB2

CVS Notification ServiceOctober 26, 2004 at 6:25 PM

CVS COMMIT LOG:
SUBJECT: [Hibernate-commits] Hibernate3/src/org/hibernate/dialect DB2Dialect.java,1.7,1.8 Dialect.java,1.17,1.18 FrontBaseDialect.java,1.4,1.5 HSQLDialect.java,1.9,1.10 InformixDialect.java,1.8,1.9 InterbaseDialect.java,1.3,1.4 MckoiDialect.java,1.2,1.3 Oracle9Dialect.java,1.8,1.9 PointbaseDialect.java,1.2,1.3 PostgreSQLDialect.java,1.5,1.6 SAPDBDialect.java,1.5,1.6 SybaseDialect.java,1.6,1.7
fixed HB-1194, use with rr in DB2

GavinGOctober 26, 2004 at 6:23 PM

Thanks.

I implemented a similar patch in HB3.

GavinGAugust 21, 2004 at 1:32 AM

Are you sure your txn is not timing out?

Fixed

Details

Assignee

Reporter

Bug Testcase Reminder (view)

Bug reports should generally be accompanied by a test case!

Bug Testcase Reminder (edit)

Bug reports should generally be accompanied by a test case!

Participants

CVS Notification Service
Francisco Llesta
GavinG

Original estimate

Time tracking

No time logged32h remaining

Components

Fix versions

Affects versions

Priority

Created August 20, 2004 at 7:22 PM
Updated October 26, 2004 at 6:36 PM
Resolved October 26, 2004 at 6:23 PM