db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andras Balogh <and...@reea.net>
Subject Re: simple join problem
Date Tue, 02 Mar 2004 13:18:13 GMT
    Hello,

You should use
Crieteria.addJoin(ViRejPeer.ASSN_REJ_ID, AssnRejPeer.ASSN_REJ_ID);
ot better if the relationship is declared as foriegn key in your schema 
you should have
a protected method in you BaseViRejPeer:

ViRejPeer.doSelectJoinAssnRej(crit) (or somethig like that :))

Make this method public in 
ViRejPeer and use it .

Best wishes,
Andras.


Travis.Prescott@novainfo.com wrote:

>I am trying to make a simple join.  Below is the Criteria I am using:
>
>  Criteria crit = new Criteria();
>  crit.add(ViRejPeer.ASSN_REJ_ID, AssnRejPeer.ASSN_REJ_ID);
>  crit.add(AssnRejPeer.REJ_STATUS_ID, 1000);
>
>The query does not work because of an "invalid number".  I know what is
>causing the Oracle error.  The Criteria produces the following query:
>
>  SELECT * 
>  FROM assn_rej, vi_rej 
>  WHERE assn_rej.REJ_STATUS_ID=1000 
>  AND vi_rej.ASSN_REJ_ID='assn_rej.ASSN_REJ_ID'
>
>The cause of the problem is the assn_rej.ASSN_REJ_ID value surrounded by
>quotes.  If the query is run on it's own without the quotes it runs fine.
>So, I started looking into the join provided by the Peer base class.  The
>problem with this is that we are managing our datasources with application
>server so I would need to pass a connection into the join method.  This
>option does not exist.  So my question, I suppose, is two-fold.  First, what
>am I doing wrong with the above Criteria.  Second, is there a way to use the
>join methods in the Peer classes and still pass in a Connection?
>
>Travis
>  
>



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message