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.  [ 2 posts ] 
Author Message
 Post subject: Braces in hql-select statement
PostPosted: Tue Jun 03, 2008 9:04 am 
Newbie

Joined: Wed Apr 26, 2006 5:28 am
Posts: 18
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

NHibernate version: 1.2.?

Full stack trace of any exception that occurs:
bei NHibernate.Hql.Classic.QueryTranslator.Compile() in C:\Programme\NHibernate\src\src\NHibernate\Hql\Classic\QueryTranslator.cs:Zeile 306.
bei NHibernate.Hql.Classic.QueryTranslator.Compile(IDictionary replacements, Boolean scalar) in C:\Programme\NHibernate\src\src\NHibernate\Hql\Classic\QueryTranslator.cs:Zeile 259.
bei NHibernate.Impl.SessionFactoryImpl.GetQuery(String queryString, Boolean shallow, IDictionary enabledFilters) in C:\Programme\NHibernate\src\src\NHibernate\Impl\SessionFactoryImpl.cs:Zeile 520.
bei NHibernate.Impl.SessionImpl.GetQueries(String query, Boolean scalar) in C:\Programme\NHibernate\src\src\NHibernate\Impl\SessionImpl.cs:Zeile 1786.
bei NHibernate.Impl.SessionImpl.Find(String query, QueryParameters parameters, IList results) in C:\Programme\NHibernate\src\src\NHibernate\Impl\SessionImpl.cs:Zeile 1753.
bei NHibernate.Impl.QueryImpl.List(IList results) in C:\Programme\NHibernate\src\src\NHibernate\Impl\QueryImpl.cs:Zeile 71.
bei TestApp.Data.Persistency.GetMachineAssignmentData(String costCenter) in \\ejot-net.com\dfs\bgh_hld_home\BEDV20\Visual Studio 2005\Projects\TestApp\TestApp.Data\Persistency.vb:Zeile 1260.
bei Service.GetMachineAssignData() in http://server/TestApp/App_Code/Service.vb:Zeile 140.


Name and version of the database you are using: Oracle 10g

Hello,

I'd like to execute the following hql:
select distinct ag.Allgemein.Projektstand.Id, sum(lg.Gesamtlos / 1000000), sum(lg.Gesamtlos / (ag.Leistung * 60 * 12)) from Arbeitsgang ag, Losgroesse lg
where lg.Allgemein = ag.Allgemein
and ag.Leistung > 0
and ag.Allgemein.Projektstand.Beschreibung not in ('A', 'B')
and (ag.Allgemein.Projektstand.Beschreibung not like 'C' or ag.Allgemein.Ausgangsdatum > :d1)
and ag.Kostenstelle = :ks
group by ag.Allgemein.Projektstand.Id

But I get an Exception:
NHibernate.QueryException - ( expected before ) in select [(see above)]

I think the problem are the braces in this part in the select-statement:
(ag.Leistung * 60 * 12)

I need this braces, otherwise the result is wrong.

How can I solve this problem?

Thanks in advanced.

_________________
=/\=

Live long and prosper


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 04, 2008 2:13 am 
Regular
Regular

Joined: Thu Mar 06, 2008 5:06 am
Posts: 68
those calculations aren't possible yet in the select part of hql statements. you have to use native sql instead...


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