Hi all !
I have 3 tables :
- VERSIONDECOMPOSANT,
- ENVIRONNEMENT,
- AS_VERCOMP_ENV : The association table between the two above.
I have the following exception when I try to get my data from the DB :
Code:
Alias [as_vercomp_env] does not correspond to any of the supplied return aliases = {[versiondecomposant]} [Select {versiondecomposant.*} from VERSIONDECOMPOSANT {versiondecomposant} where {versiondecomposant}.IDVERCOMP IN(Select {as_vercomp_env}.IDVERCOMP from AS_VERCOMP_ENV {as_vercomp_env} where {as_vercomp_env}.IDENV IN(51,53) Group By {as_vercomp_env}.IDVERCOMP having count({as_vercomp_env}.IDVERCOMP)=2) AND {versiondecomposant}.IDVERCOMP<>0]
I use CreateSQLQuery(). Why the [as_vercomp_env] alias is not found ? What could be wrong in my SQL query ?
Here are my mapping files :
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="majpps.beans.VersionDeComposant" table="versiondecomposant" lazy="false">
<id name="idVerComp" column="IDVERCOMP" unsaved-value="null">
<generator class="sequence">
<param name="seq_versiondecomposant">seq_versiondecomposant</param>
</generator>
</id>
<property name="etat">
<column name="ETAT" sql-type="NUMBER(1)" not-null="true"/>
</property>
<property name="numeroOrdre">
<column name="NUMEROORDRE" sql-type="VARCHAR2(50)" not-null="true"/>
</property>
<property name="version">
<column name="VERSION" sql-type="VARCHAR2(30)" not-null="true"/>
</property>
<property name="isDeTest">
<column name="ISDETEST" sql-type="NUMBER(1)" not-null="true"/>
</property>
<property name="fichier">
<column name="FICHIER" sql-type="VARCHAR2(50)" not-null="true"/>
</property>
<property name="repertoireCible">
<column name="REPERTOIRECIBLE" sql-type="VARCHAR2(255)" not-null="true"/>
</property>
<property name="empreinte">
<column name="EMPREINTE" sql-type="VARCHAR2(100)" not-null="true"/>
</property>
<many-to-one name="composant" column="IDCOMP" not-null="true" cascade="none"/>
<bag name="environnement" lazy="true" table="as_vercomp_env">
<key column="IDVERCOMP"/>
<many-to-many class="majpps.beans.Environnement" column="IDENV"/>
</bag>
<bag name="verCompMini" lazy="true" table="as_vercomp_vercompmini">
<key column="IDVERCOMP"/>
<many-to-many class="majpps.beans.VersionDeComposant" column="IDVERCOMPMINI"/>
</bag>
</class>
</hibernate-mapping>
<!-- parsed in 0ms -->
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="majpps.beans.Environnement" table="environnement" lazy="false">
<cache usage="read-write"/>
<id name="idEnv" column="IDENV" unsaved-value="null">
<generator class="sequence">
<param name="seq_environnement">seq_environnement</param>
</generator>
</id>
<discriminator column="TYPE_ENVIR" type="string"/>
<property name="Nom">
<column name="NOM" sql-type="VARCHAR2(50)" not-null="true"/>
</property>
<subclass name="majpps.beans.SolutionLecteur" lazy="false" discriminator-value="LECTEUR">
<property name="Nom" insert="false" update="false">
<column name="NOM" sql-type="VARCHAR2(50)" not-null="true"/>
</property>
</subclass>
<subclass name="majpps.beans.EnvironnementPoste" lazy="false" discriminator-value="POSTE">
<property name="Nom" insert="false" update="false">
<column name="NOM" sql-type="VARCHAR2(50)" not-null="true"/>
</property>
<property name="version">
<column name="VERSION" sql-type="VARCHAR2(50)" not-null="true"/>
</property>
<property name="code">
<column name="CODE" sql-type="VARCHAR2(50)" not-null="true"/>
</property>
</subclass>
</class>
</hibernate-mapping>
<!-- parsed in 0ms -->
Thank you !! =)