This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 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

hibernate 2.x -> 3.1 upgrade woes

Pierce Krouse

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] - < 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(
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(
at org.hibernate.engine.query.HQLQueryPlan.<init>(
at org.hibernate.engine.query.HQLQueryPlan.<init>(
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(
at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(
at org.hibernate.impl.SessionFactoryImpl.<init>(
at org.hibernate.cfg.Configuration.buildSessionFactory(
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.afterPropertiesSet(
at org.springframework.web.context.ContextLoader.createWebApplicationContext(
at org.springframework.web.context.ContextLoader.initWebApplicationContext(
at org.springframework.web.context.ContextLoaderListener.contextInitialized(
at org.apache.catalina.core.StandardContext.listenerStart(
at org.apache.catalina.core.StandardContext.start(
at org.apache.catalina.core.ContainerBase.addChildInternal(
at org.apache.catalina.core.ContainerBase.addChild(
at org.apache.catalina.core.StandardHost.addChild(
at org.apache.catalina.startup.HostConfig.deployDirectory(
at org.apache.catalina.startup.HostConfig.deployDirectories(
at org.apache.catalina.startup.HostConfig.deployApps(
at org.apache.catalina.startup.HostConfig.start(
at org.apache.catalina.startup.HostConfig.lifecycleEvent(
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
at org.apache.catalina.core.ContainerBase.start(
at org.apache.catalina.core.StandardHost.start(
at org.apache.catalina.core.ContainerBase.start(
at org.apache.catalina.core.StandardEngine.start(
at org.apache.catalina.core.StandardService.start(
at org.apache.catalina.core.StandardServer.start(
at org.apache.catalina.startup.Catalina.start(
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(
at org.apache.catalina.startup.Bootstrap.main(
Caused by: line 2:83: expecting CLOSE, found '('
at antlr.Parser.match(
at org.hibernate.hql.antlr.HqlBaseParser.aggregate(
at org.hibernate.hql.antlr.HqlBaseParser.identPrimary(
at org.hibernate.hql.antlr.HqlBaseParser.primaryExpression(
at org.hibernate.hql.antlr.HqlBaseParser.atom(
at org.hibernate.hql.antlr.HqlBaseParser.unaryExpression(
at org.hibernate.hql.antlr.HqlBaseParser.multiplyExpression(
at org.hibernate.hql.antlr.HqlBaseParser.additiveExpression(
at org.hibernate.hql.antlr.HqlBaseParser.concatenation(
at org.hibernate.hql.antlr.HqlBaseParser.relationalExpression(
at org.hibernate.hql.antlr.HqlBaseParser.equalityExpression(
at org.hibernate.hql.antlr.HqlBaseParser.negatedExpression(
at org.hibernate.hql.antlr.HqlBaseParser.logicalAndExpression(
at org.hibernate.hql.antlr.HqlBaseParser.logicalOrExpression(
at org.hibernate.hql.antlr.HqlBaseParser.expression(
at org.hibernate.hql.antlr.HqlBaseParser.aliasedExpression(
at org.hibernate.hql.antlr.HqlBaseParser.selectedPropertiesList(
at org.hibernate.hql.antlr.HqlBaseParser.selectClause(
at org.hibernate.hql.antlr.HqlBaseParser.selectFrom(
at org.hibernate.hql.antlr.HqlBaseParser.queryRule(
at org.hibernate.hql.antlr.HqlBaseParser.selectStatement(
at org.hibernate.hql.antlr.HqlBaseParser.statement(
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(
... 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.

I agree. Here's the link:
subject: hibernate 2.x -> 3.1 upgrade woes
It's not a secret anymore!