File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes hibernate 2.x -> 3.1 upgrade woes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "hibernate 2.x -> 3.1 upgrade woes" Watch "hibernate 2.x -> 3.1 upgrade woes" New topic
Author

hibernate 2.x -> 3.1 upgrade woes

Pierce Krouse
Greenhorn

Joined: Jan 31, 2006
Posts: 3
I am migrating a legacy app from hibernate 2.x to 3.1 with little success. The app runs under tomcat 5.5 and uses Spring to drive hibernate. I know very little about Spring, so right now it's probably my biggest headache. I upgraded the app from spring 1.1.5 to 1.2.6 so that we could move it up to hibernate 3. I managed to do this, and all my tests still work, so I am partway there. I implemented the changes spelled out in the hibernate migration document, and now I am running into problems. I knew I should be using the old parser with this legacy code, so I updated the hibernate.cfg.xml file to look like this:


This did not affect the stach trace given below, so then I figured maybe Spring was controlling hibernate, and I assumed the hibernate.cfg.xml file was something left over from the pre-spring days. I found applicationContext-hibernate.xml file, and updated it with the same basic information to look like this:



So when I start tomcat, this is the stack trace that gets logged:
(please ignore the ehcache problem, it always uses the default config file, even before the upgrades, and it works fine that way)

2006-01-31 16:16:44,506 WARN [com.perfretail.k2v1.utils.SystemDate] - <systemdate.properties not found in C:\WINDOWS\system32>
2006-01-31 16:16:44,881 WARN [net.sf.ehcache.config.Configurator] - <No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/C:/etc/bin/Tomcat%205.5/webapps/k2v02/WEB-INF/lib/ehcache-1.1.jar!/ehcache-failsafe.xml>
2006-01-31 16:16:47,038 ERROR [org.hibernate.hql.PARSER] - <line 2:95: expecting CLOSE, found '('>
2006-01-31 16:16:47,053 ERROR [org.hibernate.hql.PARSER] - <line 2:95: expecting CLOSE, found '('>
2006-01-31 16:16:47,100 ERROR [org.hibernate.hql.PARSER] - <line 2:95: expecting CLOSE, found '('>
2006-01-31 16:16:47,147 ERROR [org.hibernate.hql.PARSER] - <line 19:14: unexpected token: LIMIT>
2006-01-31 16:16:47,147 WARN [org.hibernate.hql.ast.HqlParser] - <processEqualityExpression() : No expression to process!>
2006-01-31 16:16:47,147 ERROR [org.hibernate.hql.PARSER] - <line 2:83: expecting CLOSE, found '('>
2006-01-31 16:16:47,163 ERROR [org.hibernate.hql.PARSER] - <line 2:83: expecting CLOSE, found '('>
2006-01-31 16:16:47,163 ERROR [org.hibernate.hql.PARSER] - <line 7:14: unexpected token: LIMIT>
2006-01-31 16:16:47,163 WARN [org.hibernate.hql.ast.HqlParser] - <processEqualityExpression() : No expression to process!>
2006-01-31 16:16:47,163 ERROR [org.hibernate.hql.PARSER] - <line 2:83: expecting CLOSE, found '('>
2006-01-31 16:16:47,163 ERROR [org.hibernate.hql.PARSER] - <line 2:95: expecting CLOSE, found '('>
2006-01-31 16:16:47,178 ERROR [org.hibernate.hql.PARSER] - <line 2:83: expecting CLOSE, found '('>
2006-01-31 16:16:47,194 ERROR [org.hibernate.impl.SessionFactoryImpl] - <Error in named query: com.perfretail.k2v1.trackers.registerops.operatorsForSelectSites>
org.hibernate.hql.ast.QuerySyntaxException: expecting CLOSE, found '(' near line 2, column 83 [
select distinct item.siteUuid, item.operatorId, count(distinct to_days(from_unixtime(item.timeStamp / 1000)))
from com.perfretail.k2v1.trackers.registerops.RegisterOpsItem as item
where item.chainUuid = :chainUuid and
item.siteUuid in (:siteUuids) and
item.status = :status and
item.timeStamp >= :start and
item.timeStamp < :end
group by item.siteUuid, item.operatorId]
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:59)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:244)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:155)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:105)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:74)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:53)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:363)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:327)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1154)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:800)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:726)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1059)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:363)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:176)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:105)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1013)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:824)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:345)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:176)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:105)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1013)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:824)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:345)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:147)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:203)
at org.springframework.context.support.AbstractApplicationContext.getBeansOfType(AbstractApplicationContext.java:614)
at org.springframework.context.support.AbstractApplicationContext.registerListeners(AbstractApplicationContext.java:496)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:317)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:134)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3669)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4104)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:894)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:857)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:475)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1102)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
at org.apache.catalina.core.StandardService.start(StandardService.java:450)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
Caused by: line 2:83: expecting CLOSE, found '('
at antlr.Parser.match(Parser.java:211)
at org.hibernate.hql.antlr.HqlBaseParser.aggregate(HqlBaseParser.java:4385)
at org.hibernate.hql.antlr.HqlBaseParser.identPrimary(HqlBaseParser.java:4036)
at org.hibernate.hql.antlr.HqlBaseParser.primaryExpression(HqlBaseParser.java:861)
at org.hibernate.hql.antlr.HqlBaseParser.atom(HqlBaseParser.java:3422)
at org.hibernate.hql.antlr.HqlBaseParser.unaryExpression(HqlBaseParser.java:3200)
at org.hibernate.hql.antlr.HqlBaseParser.multiplyExpression(HqlBaseParser.java:3082)
at org.hibernate.hql.antlr.HqlBaseParser.additiveExpression(HqlBaseParser.java:2802)
at org.hibernate.hql.antlr.HqlBaseParser.concatenation(HqlBaseParser.java:570)
at org.hibernate.hql.antlr.HqlBaseParser.relationalExpression(HqlBaseParser.java:2586)
at org.hibernate.hql.antlr.HqlBaseParser.equalityExpression(HqlBaseParser.java:2449)
at org.hibernate.hql.antlr.HqlBaseParser.negatedExpression(HqlBaseParser.java:2413)
at org.hibernate.hql.antlr.HqlBaseParser.logicalAndExpression(HqlBaseParser.java:2331)
at org.hibernate.hql.antlr.HqlBaseParser.logicalOrExpression(HqlBaseParser.java:2296)
at org.hibernate.hql.antlr.HqlBaseParser.expression(HqlBaseParser.java:2082)
at org.hibernate.hql.antlr.HqlBaseParser.aliasedExpression(HqlBaseParser.java:2249)
at org.hibernate.hql.antlr.HqlBaseParser.selectedPropertiesList(HqlBaseParser.java:1462)
at org.hibernate.hql.antlr.HqlBaseParser.selectClause(HqlBaseParser.java:1365)
at org.hibernate.hql.antlr.HqlBaseParser.selectFrom(HqlBaseParser.java:1106)
at org.hibernate.hql.antlr.HqlBaseParser.queryRule(HqlBaseParser.java:702)
at org.hibernate.hql.antlr.HqlBaseParser.selectStatement(HqlBaseParser.java:296)
at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:159)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:238)
... 60 more
2006-01-31 16:16:47,210 ERROR [org.hibernate.impl.SessionFactoryImpl] - <Error in named query: com.perfretail.k2v1.trackers.sales.salesDateWindow>


I'm stalled at this point.

--PK
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: hibernate 2.x -> 3.1 upgrade woes
 
Similar Threads
Getting No suitable driver error using hibernate.
spring 2.5.3 / hibernate 3 sessionFactory NullPointerException
get ref bean from applicationContext.xml
Upgrading to HIbernate3.2 and Spring 2.0
org.springframework.beans.factory.BeanCreationException