-->
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: Prolem DB2 dialect and LockMode.UPGRADE in Hibernate 3.1
PostPosted: Thu Jan 26, 2006 6:23 am 
Newbie

Joined: Wed Jan 25, 2006 1:32 pm
Posts: 2
Hi,

I have a configuration with hibernate running in Websphere 5.1 and jdk 1.4 for mapping a db2 database.
I'm using a load with LockMode.UPGRADE to lock the line. I'm doing this to get a key from a database without a sequence. It works with Hibernate 3.0 and generate a request SQL like "select ... for update with rr"

I upgrade from Hibernate 3.0 to hibernate 3.1 and It stop working. (the line is not locked) and the request SQL is like "select ... for read only with rs".

I declared a new dialect extending db2dialect like this

public class ExOctavDB2Dialect extends DB2Dialect {
public String getForUpdateString() {
return " for update with rr";
}
}

and now it works.

I take a look at CVS repository and i've seen that
the file cvs: hibernate/Hibernate3/src/org/hibernate/dialect/DB2Dialect.java

Changed this line in version 1.34
FROM
return " for update with rr";
TO
return " for read only with rs use and keep exclusive locks";

with the label HHH-378, better LockMode.UPGRADE on DB2

It was changed in version 1.35
FROM
return " for read only with rs use and keep exclusive locks";
TO
return " for read only with rs";

with the label fixed broken db2dialect

I think the rollback from version 1.35 to version 1.34 is not well done.

I think it should go in issue tracking but I want to ask you before polluting your jira.

Thank you

Kefah

Added 13/02/2006 Can somebody reply to my topic please ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 06, 2006 2:50 am 
Newbie

Joined: Wed Sep 06, 2006 2:34 am
Posts: 1
Location: Berlin
Hi kefah,
I think the problem is that the option to lock a row is hardcoded in the given method (getForUpdateString()). DB2 supports a lot of transaction serialization levels. The level 'rr' (repeatable read) tries to set a lock on the table and is not what we want. The level 'cs' (cursor stability) is better suited.
So it should be a good idea to set this option depending on the configured transaction serialization level.
Maybe Gavin would like so kind to make a little refactoring to that method and introduce a parameter (int serializationLevel) to choose the option according to the given parameter value.
regards Lutz
ps. Here a link to the DB2 documentation
http://publib.boulder.ibm.com/infocente ... /index.jsp
The isolation levels are contained within the manual 'SQL Reference'


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 06, 2006 4:13 am 
Newbie

Joined: Wed Jan 25, 2006 1:32 pm
Posts: 2
Hi Lutz,

I'm happy to see that my problem interests someone.

I understand your needs and I think you're right about the new parameter because there is not only one way to lock a row in sql.

I solve my problem by extending the DB2Dialect and redefinied the getForUpdateString(). Then I referenced the new dialect in hibernate-cfg.xml.

I don't think this solution will help you solve your problem but I don't get ANY answer from Hibernate Dev Team and that's why I went for this solution.

Good luck for your problem and hope it will help you


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.