[hibernate-issues] A Little bug in 3.2.1

Urban.Lindberg at tietoenator.com Urban.Lindberg at tietoenator.com
Mon Dec 18 03:15:26 EST 2006


Hi

I believe I just discovered little bug in Hibernate 3.2.1.

If you have a table named VC and a column with the same name (VC) and
you define this HQL:

Strinh hbsql="update VC set timestamp='xxxx' where VC =:vcId"

session.createQuery(hbsql).setString("vcId",
aVC.getVcId()).executeUpdate();


You will get a Nullpointer in SessionFactoryHelper.findSQLFunction there
is a easy workaround, just rename the VC java object to something
different then the column name.

I post it here and maybe someone wll be helped by it, it took me some
hours before I found it. I believe this occured in 3.2.1 because it has
worked in an erlier version, 3.0.x. (don't rember exactly which we used
earlier)

Here is a trace:

java.lang.NullPointerException
	at
org.hibernate.hql.ast.util.SessionFactoryHelper.findSQLFunction(SessionF
actoryHelper.java:342)
	at
org.hibernate.hql.ast.tree.IdentNode.getDataType(IdentNode.java:266)
	at
org.hibernate.hql.ast.tree.BinaryLogicOperatorNode.extractDataType(Binar
yLogicOperatorNode.java:168)
	at
org.hibernate.hql.ast.tree.BinaryLogicOperatorNode.initialize(BinaryLogi
cOperatorNode.java:34)
	at
org.hibernate.hql.ast.HqlSqlWalker.prepareLogicOperator(HqlSqlWalker.jav
a:1006)
	at
org.hibernate.hql.antlr.HqlSqlBaseWalker.comparisonExpr(HqlSqlBaseWalker
.java:3992)
	at
org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.ja
va:1762)
	at
org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.ja
va:1690)
	at
org.hibernate.hql.antlr.HqlSqlBaseWalker.logicalExpr(HqlSqlBaseWalker.ja
va:1687)
	at
org.hibernate.hql.antlr.HqlSqlBaseWalker.whereClause(HqlSqlBaseWalker.ja
va:776)
	at
org.hibernate.hql.antlr.HqlSqlBaseWalker.updateStatement(HqlSqlBaseWalke
r.java:358)
	at
org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java
:237)
	at
org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.ja
va:228)
	at
org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.
java:160)
	at
org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.ja
va:111)
	at
org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
	at
org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
	at
org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache
.java:72)
	at
org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionIm
pl.java:133)
	at
org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.j
ava:112)
	at
org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1623)
	at
com.teliasonera.wal.inventory.atmpvc.dao.SybaseATMPVCDAO.updateVC(Sybase
ATMPVCDAO.java:398)
	at
com.teliasonera.wal.inventory.atmpvc.ATMPVCHandler.updateVC(ATMPVCHandle
r.java:203)
	at
com.teliasonera.wal.inventory.atmpvc.ATMPVCHandler.updateVC(ATMPVCHandle
r.java:197)
	at
com.teliasonera.wal.inventory.atmpvc.ATMPVCHandlerTest.testUpdateVC(ATMP
VCHandlerTest.java:164)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.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
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUn
it3TestReference.java:128)
	at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.ja
va:38)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:460)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:673)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
ner.java:386)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
nner.java:196)




More information about the hibernate-issues mailing list