[hibernate] undefined alias
Bonjour,
je dois réaliser des décomptes mensuels via la requête HQL suivante qui fonctionne très bien pour le calcul des sommes hors-taxe :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
select
new xxx.yyy.DecompteMensuelEnveloppe(
sum(art.totalHT)),
art.bonCommande.enveloppe,
Month(art.bonCommande.dateEmission)
)
from
ArticleBDC art join art.TVA tva
where
art.annul = 0
and art.bonCommande.annul = 0
and Year(art.bonCommande.dateEmission)=2006
group by art.bonCommande.enveloppe,Month(art.bonCommande.dateEmission) |
Dès que je veux passer au calcul du TTC, je me retrouve avec un "undefined alias : art" alors que ma requête comporte bien des alias correctement définis (enfin, je le pensais :( )
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
select
new xxx.yyy.DecompteMensuelEnveloppe(
sum(art.totalHT*tva.facteurTVA),
art.bonCommande.enveloppe ,
Month(art.bonCommande.dateEmission)
)
from
ArticleBDC art join art.TVA tva
where
art.annul = 0
and art.bonCommande.annul = 0
and Year(art.bonCommande.dateEmission)=2006
group by art.bonCommande.enveloppe, Month(art.bonCommande.dateEmission) |
Voici mes fichiers de mapping :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
<class name="Article" table="article">
...
...
<property
column="prix_unit_HT"
name="prixUnitHT"
not-null="true"
type="float"
/>
<property
column="remise"
name="remise"
not-null="true"
type="float"
/>
<property
column="quantite"
name="quantite"
not-null="true"
type="float"
/>
<property name="totalHT"
type="float"
formula="prix_unit_HT*quantite*(1-remise/100)"/>
<many-to-one
cascade="none"
class="TVA"
column="id_TVA"
name="TVA"
/>
...
...
</class>
<class
name="TVA"
table="taux_TVA"
>
...
...
<property
name="tauxTVA"
column="taux_TVA"
type="float"
not-null="true"
/>
<property
name="facteurTVA"
type="float"
formula="1+taux_TVA/100"
/>
...
...
</class> |
Je sèche un peu...si qq'un a une petite idée, je suis preneur.
Merci par avance !