I can't write my query. Here is the class generated by hbmToJava
public class DicoLigne implements Serializable {
/** identifier field */
private Long id;
/** persistent field */
private String concept;
/** persistent field */
private List traduction;
}
The list referes to a List of persitent objet (Mot.class)
Mot.class :
public class Mot implements Serializable {
/** identifier field */
private Long id;
/** persistent field */
private String intitule;
/** nullable persistent field */
private String genre;
}
Given an objet Mot (called M1), I want to select all DicoLigne objets that contain Objet Mot which have the same attrbiut "intitule" than M1's one.
I tried to use the operator in elements(). ... but doesn'"t work.
I tried something like this :
Query q = session.createQuery("select dicoLigne from business.entities.DicoLigne as dicoLigne where :intitule in elements(dicoLigne.List.intitule)");
q.setString("intitule", "Sample");
here is a snipet a my hbm :
<class name="business.entities.DicoLigne" table="t_dico_ligne">
<id name="id" column="id" type="long">
<generator class="increment" />
</id>
<property name="concept" column="concept" type="string" not-null="true"/>
<list name="traduction">
<key column="id_dico"/>
<index column="id_mot"/>
<many-to-many class="business.entities.Mot"/>
</list>
</class>
<class name="business.entities.Mot" table="t_mot">
<id name="id" column="id" type="long">
<generator class="increment" />
</id>
<discriminator column="t_mot_type" type="string"/>
<property name="intitule" column="intitule" type="string" not-null="true"/>
<property name="genre" column="genre" type="string" not-null="false"/>
<subclass name="business.entities.MotFr" discriminator-value="francais"/>
</class>
Thx a lot
|