I am implementing the new TableGenerator on Microsoft SQL Server 2005 with jTDS driver version 1.2.5 latest one. But getting the following error. I need help from hibernate community.
18:50:17,910 ERROR TableGenerator:250 - could not read or init a hi value java.sql.SQLException: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR.
Complete Log is below:
18:54:39,383 INFO SchemaExport:196 - schema export complete 18:54:39,398 DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1 18:54:39,398 DEBUG SessionFactoryImpl:392 - Checking 0 named HQL queries 18:54:39,398 DEBUG SessionFactoryImpl:412 - Checking 0 named SQL queries 18:54:39,430 DEBUG SessionImpl:220 - opened session at timestamp: 12684020793 18:54:39,445 DEBUG DefaultSaveOrUpdateEventListener:158 - saving transient instance 18:54:39,445 DEBUG AbstractBatcher:556 - opening JDBC connection 18:54:39,445 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0 18:54:39,445 DEBUG DriverManagerConnectionProvider:99 - using pooled JDBC connection, pool size: 0 18:54:39,445 DEBUG SQL:222 - select next_val from hibernate_sequences tbl where tbl.sequence_name=? for update 18:54:39,461 ERROR TableGenerator:250 - could not read or init a hi value java.sql.SQLException: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR. at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368) at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820) at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258) at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632) at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:477) at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:776) at org.hibernate.id.enhanced.TableGenerator.doWorkInCurrentTransaction(TableGenerator.java:226) at org.hibernate.engine.TransactionHelper$1Work.doWork(TransactionHelper.java:38) at org.hibernate.engine.transaction.Isolater$JdbcDelegate.delegateWork(Isolater.java:187) at org.hibernate.engine.transaction.Isolater.doIsolatedWork(Isolater.java:43) at org.hibernate.engine.TransactionHelper.doWorkInNewTransaction(TransactionHelper.java:51) at org.hibernate.id.enhanced.TableGenerator$1.getNextValue(TableGenerator.java:211) at org.hibernate.id.enhanced.OptimizerFactory$PooledOptimizer.generate(OptimizerFactory.java:173) at org.hibernate.id.enhanced.TableGenerator.generate(TableGenerator.java:208) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:99) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187) at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172) at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70) at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519) at com.netsol.domain.AppTest.testSequenceTableWithMySQL(AppTest.java:78) 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:597) at junit.framework.TestCase.runTest(TestCase.java:164) at junit.framework.TestCase.runBare(TestCase.java:130) 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:120) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) 18:54:39,461 DEBUG JDBCExceptionReporter:69 - could not get or update next value [null] java.sql.SQLException: Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR. at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:368) at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2820) at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2258) at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:632) at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:477) at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:776) at org.hibernate.id.enhanced.TableGenerator.doWorkInCurrentTransaction(TableGenerator.java:226) at org.hibernate.engine.TransactionHelper$1Work.doWork(TransactionHelper.java:38) at org.hibernate.engine.transaction.Isolater$JdbcDelegate.delegateWork(Isolater.java:187) at org.hibernate.engine.transaction.Isolater.doIsolatedWork(Isolater.java:43) at org.hibernate.engine.TransactionHelper.doWorkInNewTransaction(TransactionHelper.java:51) at org.hibernate.id.enhanced.TableGenerator$1.getNextValue(TableGenerator.java:211) at org.hibernate.id.enhanced.OptimizerFactory$PooledOptimizer.generate(OptimizerFactory.java:173) at org.hibernate.id.enhanced.TableGenerator.generate(TableGenerator.java:208) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:99) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187) at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172) at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70) at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523) at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519) at com.netsol.domain.AppTest.testSequenceTableWithMySQL(AppTest.java:78) 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:597) at junit.framework.TestCase.runTest(TestCase.java:164) at junit.framework.TestCase.runBare(TestCase.java:130) 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:120) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197) 18:54:39,461 WARN JDBCExceptionReporter:77 - SQL Error: 1003, SQLState: S1000 18:54:39,461 ERROR JDBCExceptionReporter:78 - Line 1: FOR UPDATE clause allowed only for DECLARE CURSOR. 18:54:39,461 DEBUG AbstractBatcher:571 - closing JDBC connection (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0) 18:54:39,461 DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1
_________________ Faisal Basra
|