-->
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.  [ 2 posts ] 
Author Message
 Post subject: SQL command error using LockMode.UPGRADE_NOWAIT
PostPosted: Wed Jun 15, 2005 2:23 pm 
Newbie

Joined: Mon Jan 10, 2005 8:03 pm
Posts: 2
I think there is a problem w/ the generated sql when running an HQL query with LockMode.UPGRADE_NOWAIT. The generated sql seems to be correct, however, when I change Oracle9Dialect.getForUpdateNowaitString(String) from:

public String getForUpdateNowaitString(String aliases) {
return getForUpdateNowaitString() + " of " + aliases;
}

to:

public String getForUpdateNowaitString(String aliases) {
return " for update of " + aliases + " nowait";
}

My apologies in advance if I'm wrong about this.

Hibernate version: 3.0.5

Mapping documents:
<query name="com.foo.domain.entity.Group.findByName">
from Group as g where g.name = :name
</query>

Code between sessionFactory.openSession() and session.close():
Query query = this.getSession().getNamedQuery("com.foo.domain.entity.Group.findByName");
query.setParameter("name", name);
query.setLockMode("g", LockMode.UPGRADE_NOWAIT);
List<Group> list = query.list();

Full stack trace of any exception that occurs:
org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:1596)
at org.hibernate.loader.Loader.list(Loader.java:1577)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at com.foo.domain.dao.GroupHibernateDao.lockByName(GroupHibernateDao.java:45)
at com.foo.domain.dao.TestGroupHibernateDao.testLockByName(TestGroupHibernateDao.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)
Caused by: java.sql.SQLException: ORA-00933: SQL command not properly ended

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:626)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:182)
at oracle.jdbc.driver.T4CPreparedStatement.execute_for_describe(T4CPreparedStatement.java:500)
at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:942)
at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:532)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1037)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2905)
at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:2946)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:120)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1272)
at org.hibernate.loader.Loader.doQuery(Loader.java:391)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
at org.hibernate.loader.Loader.doList(Loader.java:1593)
... 22 more


Name and version of the database you are using: Oracle 8.1.7

The generated SQL (show_sql=true):
select group0_.ID as ID, group0_.NAME as NAME28_, group0_.PARENT_ID as PARENT3_28_ from domain.DOMAIN_GROUP group0_ where group0_.NAME=? for update nowait of group0_.ID

Debug level Hibernate log excerpt:
- SQL Error: 933, SQLState: 42000
- ORA-00933: SQL command not properly ended


Top
 Profile  
 
 Post subject: I met the same problem.
PostPosted: Sat Jul 30, 2005 9:40 pm 
Newbie

Joined: Fri Jul 08, 2005 8:41 pm
Posts: 2
:(


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.