-->
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.  [ 1 post ] 
Author Message
 Post subject: Query with a list
PostPosted: Mon Nov 29, 2004 10:18 pm 
Newbie

Joined: Mon Nov 29, 2004 9:04 pm
Posts: 4
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.