-->
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.  [ 4 posts ] 
Author Message
 Post subject: Problem Hibernate 3.1rc1 and in-memory HSQLDB
PostPosted: Tue Oct 11, 2005 9:08 am 
Newbie

Joined: Fri May 27, 2005 10:45 am
Posts: 6
Hi,

I'm using in-memory HSQLDB for my unit tests. All my tests are ok using hibernate 3.0.5 and HSQLDB 1.7.2 or 1.8.0.

I tried Hibernate 3.1rc1 (and beta3 before). Nothing is changed except the hibernate library. All my tests fail with the following exception:

java.util.NoSuchElementException
at org.hsqldb.lib.IntValueHashMap.get(Unknown Source)
at org.hsqldb.CompiledStatementManager.getStatementID(Unknown Source)
at org.hsqldb.Session.sqlPrepare(Unknown Source)
at org.hsqldb.Session.execute(Unknown Source)
at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)
at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:431)
at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:366)
at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:105)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1561)
at org.hibernate.loader.Loader.doQuery(Loader.java:661)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:223)
at org.hibernate.loader.Loader.doList(Loader.java:2147)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2026)
at org.hibernate.loader.Loader.list(Loader.java:2021)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:109)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1547)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:165)
at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:650)
at com.db.eps.common.entitlement.service.authorization.impl.HibernateAuthorizationImpl$1.executeIn(HibernateAuthorizationImpl.java:115)
at com.db.eps.common.persistence.hibernate.support.AbstractHibernateDAO.process(AbstractHibernateDAO.java:44)
at com.db.eps.common.entitlement.service.authorization.impl.HibernateAuthorizationImpl.isAuthorizedForDirectGroupMembership(HibernateAuthorizationImpl.java:103)
at com.db.eps.common.entitlement.service.authorization.impl.HibernateAuthorizationImpl.isAuthorized(HibernateAuthorizationImpl.java:77)
at com.db.eps.common.entitlement.service.authorization.impl.TestAuthorization.testAuthorizationIsNotGrantedIfUserDoesNotHaveACL(TestAuthorization.java:87)
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:324)
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:436)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:311)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)

Here is config for HSQLDB

<property name="connection.username">sa</property>
<property name="connection.url">jdbc:hsqldb:mem:testdb</property>
<property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="connection.username">sa</property>
<property name="connection.password"></property>
<property name="dialect">org.hibernate.dialect.HSQLDialect</property>
<property name="show_sql">true</property>
<property name="hibernate.query.factory_class">org.hibernate.hql.ast.ASTQueryTranslatorFactory</property>

The hibernate generated for each test is:

Hibernate: null

Any idea ?
Thanks
Patrick


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 9:40 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
The most likely way that the SQL becomes null would be an Interceptor impl which does not properly define onPrepareStatement().


Top
 Profile  
 
 Post subject: Interceptor onPrepareStatement() was the problem...
PostPosted: Tue Oct 11, 2005 9:58 am 
Newbie

Joined: Fri May 27, 2005 10:45 am
Posts: 6
Thank you very much for your answer. Indeed, I had an interceptor. And I have let eclipse generate the code for the new methods of Hibernate Interceptor in 3.1. The onPrepareStatement(String) method returned null instead of the argument of the method... Now it works fine. Thanks again !


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 11, 2005 11:11 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
NP. The easiest approach is to extend org.hibernate.EmptyInterceptor; that way you need only override the methods you care about...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.