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.  [ 2 posts ] 
Author Message
 Post subject: Simple question: how to recover a list?
PostPosted: Wed Jul 06, 2005 9:37 am 
Newbie

Joined: Mon Jun 27, 2005 10:29 am
Posts: 4
One of my pojo (called Contract) contains a List, called DocumentList which contains a pojo called ContractDocument.
This list has been mapped like this: (xdoclet code)
Code:
    /**
    * @hibernate.bag
    *    inverse="true"
    *    lazy="false"
    *    cascade="all-delete-orphan"
    * @hibernate.collection-key
    *    column="ID_CONTRACT"
    * @hibernate.collection-one-to-many
    *    class="com.synos.egov.licitacao.pojo.ContractDocument"
    */


Contract also has an number field, that tells me what is the number of the contract. My doubt is, what is the hql I need that will give me back that list, when I have the number of Contract? I have tried this but it doesn't work:

Code:
            String search = "select con.DocumentList " +
                     "from " +
                        "Contract con, " +
                     "where " +
                        "con.id = :contract ";
      Query query = sess.createQuery(busca);
           
      query.setInteger("contract", Integer.parseInt(number));
         
     List documents = query.list();



Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 06, 2005 10:41 am 
Newbie

Joined: Tue Jul 05, 2005 9:48 am
Posts: 15
try that...

String search = "your query";
list= session.createQuery(search).list();


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

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