-->
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: Facing issues with lockmode.upgrade
PostPosted: Wed Apr 06, 2005 2:07 am 
Newbie

Joined: Tue Apr 05, 2005 10:46 am
Posts: 1
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: Hibernate 2

here are the string literals that i am using to generate my query

public static String GET_AVAILABLE_CTN_NUMBERS_FROM = "from CTNAvailable cTNAvl ";
public static String GET_AVAILABLE_CTN_NUMBERS_STATUS_AVAILABLE = "where cTNAvl.status=:status1 ";
public static String GET_AVAILBLE_CTN_NUMBERS_STATUS_PICKED = "or cTNAvl.status=:status2 ";
public static String GET_AVAILABLE_CTN_NUMBERS_TIMESTAMP = "and :currentTimeStamp > cTNAvl.timeStamp + interval '30' minute";


and here is the code that i am using

String queryString = HibernateQL.GET_AVAILABLE_CTN_NUMBERS_FROM +
HibernateQL.GET_AVAILABLE_CTN_NUMBERS_STATUS_AVAILABLE +
HibernateQL.GET_AVAILBLE_CTN_NUMBERS_STATUS_PICKED +
HibernateQL.GET_AVAILABLE_CTN_NUMBERS_TIMESTAMP;

// creating the query
query = session.createQuery(queryString);

//setting the query parameters
query.setInteger("status1", 1);
query.setLong("status2", 2);
query.setLockMode("cTNAvl", LockMode.UPGRADE);
query.setParameter ("currentTimeStamp", currentTimestamp);

resultList = query.list();


this is the query that hibernate is generating

Hibernate: select * from ( select ctnavailab0_.CTN_ID as CTN_ID, ctnavailab0_.VE
RSION as VERSION, ctnavailab0_.ALLOCATION_TIME_STAMP as ALLOCATI3_, ctnavailab0_
.PRICE as PRICE, ctnavailab0_.STATUS_ID as STATUS_ID, ctnavailab0_.CTN_NUMBER as
CTN_NUMBER, ctnavailab0_.CREATION_TIME as CREATION7_, ctnavailab0_.CTN_TRACKER_
ID as CTN_TRAC8_ from WRP_CHKOUT_CTN_POOL ctnavailab0_ where (ctnavailab0_.STATU
S_ID=? )or(ctnavailab0_.STATUS_ID=? )and(?>ctnavailab0_.ALLOCATION_TIME_STAMP+in
terval '30' minute ) for update ) where rownum <= ?


and this is the error that it is throwing

[2005-04-05 21:27:36,864] [ExecuteThread: '11' for queue: 'default'] WARN (hibe
rnate.util.JDBCExceptionReporter) - SQL Error: 907, SQLState: 42000
[2005-04-05 21:27:36,864] [ExecuteThread: '11' for queue: 'default'] ERROR (hibe
rnate.util.JDBCExceptionReporter) - ORA-00907: missing right parenthesis

[2005-04-05 21:27:36,880] [ExecuteThread: '11' for queue: 'default'] WARN (hibe
rnate.util.JDBCExceptionReporter) - SQL Error: 907, SQLState: 42000
[2005-04-05 21:27:36,880] [ExecuteThread: '11' for queue: 'default'] ERROR (hibe
rnate.util.JDBCExceptionReporter) - ORA-00907: missing right parenthesis


If we see the query the parenthesis after the "for update" should come before it for the query to work

If anyone has faced this problem please let me know a way out.

Thanks and Regards,
Abhinav

_________________
Abhinav


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