-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate 3 QuerySyntaxError
PostPosted: Tue Apr 05, 2005 1:13 pm 
Newbie

Joined: Thu Aug 28, 2003 11:49 am
Posts: 15
Location: Calgary, Alberta, Canada
Using Hibernate 3.0 final against PostgreSQL and Oracle. Here's the stack trace:
Code:
org.hibernate.hql.ast.QuerySyntaxError: expecting CLOSE, found '+' near line 1, column 161
    [select
        ss.id.sku.sizeCode,
        ss.id.sku.sizeName,
        sum( ss.endOfPeriod.units.thisWeek ),
        sum( ss.inTransit.units.thisWeek ),
        sum( ss.sales.units.thisWeek
            +  ss.sales.units.oneWeekAgo
            + ss.sales.units.twoWeeksAgo
            + ss.sales.units.threeWeeksAgo),
        sum( ss.sales.units.lifeToDate),
        sum( ss.receipts.units.lifeToDate),
        sum( ss.transfers.units.lifeToDate),
        sum( ss.adjustments.units.lifeToDate),
        sum( ss.replenishmentMinUnits),
        sum( ss.replenishmentMaxUnits),
        min( ss.replenishmentStartDate),
        max( ss.replenishmentEndDate)
    from
        com.fgl.stylecard.model.SkuStore as ss     
        inner join  ss.id.sku as sku 
    where
        sku.styleNumber = :styleNumber
    group by
        ss.id.sku.sizeCode,
        ss.id.sku.sizeName,
        ss.id.sku.sizeCode
    order by
        ss.id.sku.sizeCode]
    at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63)
    at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:215)
    at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:127)
    at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)


It looks like it's complaining about the sum( propertyA + propertyB) expression. This worked in Hibernate 2.1.x.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 05, 2005 2:04 pm 
Newbie

Joined: Thu Aug 28, 2003 11:49 am
Posts: 15
Location: Calgary, Alberta, Canada
I tried using the Classic Query Translator and got this:

Code:
INFO  SettingsFactory:273 - Query translator: org.hibernate.hql.classic.ClassicQueryTranslatorFactory
ERROR StandardWrapper[/stylecard:action]:269 - Servlet.service() for servlet action threw exception
org.hibernate.HibernateException: could not instantiate QueryTranslatorFactory: org.hibernate.hql.classic.ClassicQueryTranslatorFactory
   at org.hibernate.cfg.SettingsFactory.createQueryTranslatorFactory(SettingsFactory.java:278)
   at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:103)
   at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1505)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1053)


Any suggestions?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 06, 2005 2:06 pm 
Newbie

Joined: Thu Aug 28, 2003 11:49 am
Posts: 15
Location: Calgary, Alberta, Canada
I'm getting around the problem by using a JDBC SQL statement. I'm not exactly thrilled with that solution but I sure am happy that Hibernate gets out of the way when you need it to :-)


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