SELECT blabla AS x... => AS (alias) not working in EclipseLink 2.5 (glassfish4) [message #1065497] |
Wed, 26 June 2013 07:19 |
Guillaume Lepinay Messages: 3 Registered: June 2013 |
Junior Member |
|
|
Hello everybody,
It's my first post here. My name is Guillaume.
I'm currently using GlassFish 3.1.2.2 and EclipseLink 2.3.2 (provided by GlassFish).
My project is working fine, for example, a basic query (what is important is the alias in the SELECT clause) :
Query q = em.createQuery(
"SELECT FUNC('MONTH', o.dateOperation) mois, FUNC('YEAR', o.dateOperation) annee, o.category.name categ, SUM(o.amount) "
+ "FROM BBankOperation o "
+ "WHERE o.account.client=:c AND o.account.type=:at AND o.dateOperation BETWEEN :d1 AND :d2 AND o.amount<:z AND o.category.offBudget=:f "
+ "GROUP BY annee, mois, categ "
+ "ORDER BY annee ASC, mois ASC, categ ASC").
setParameter("c", client).setParameter("d1", d1).setParameter("d2", d2).setParameter("z", 0).setParameter("f", false).setParameter("at", accountType);
List<Object[]> r = q.getResultList();
This query is working fine on GlassFish v3.
I'm currently trying to use GlassFish4, but I encounter a problem on this query (and all the query that uses an alias in the SELECT clause.
The error displayed by EclipseLink 2.5 (2.5.0.v20130507-3faac2b) (provided by GlassFish4) :
Caused by: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
Exception Description: Problem compiling [SELECT FUNC('MONTH', o.dateOperation) mois, FUNC('YEAR', o.dateOperation) annee, o.category.name categorie, SUM(o.amount) montant FROM BBankOperation o WHERE o.account.client=:c AND o.account.type=:at AND o.dateOperation BETWEEN :d1 AND :d2 AND o.amount<:z AND o.category.offBudget=:f GROUP BY annee,mois,categorie ORDER BY annee ASC, mois ASC, categorie ASC].
[b][color=orange][238, 243] The identification variable 'annee' is not defined in the FROM clause.
[251, 260] The identification variable 'categorie' is not defined in the FROM clause.
[270, 275] The identification variable 'annee' is not defined in the FROM clause.
[291, 300] The identification variable 'categorie' is not defined in the FROM clause.[/color]
[/b] at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1585)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.createQuery(EntityManagerWrapper.java:456)
at com.clangen.boursomoney.facades.BBankOperationFacade.getExpensesPerMonthByCategoriesBetween(BBankOperationFacade.java:1133)
I really don't understand why it's not working.
I recheck it's working fine in GlassFish 3. And I tried to install EclipseLink 4.1 in GlassFish 4... but I think I can't because of the version of Java used to compile them.
Is there something to do with the new version to make the alias accepted ?
Thank you for your help.
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03847 seconds