Title: RE: [JBoss-user] Problem with Custom finders ....
It's surprising it works when the select statement must have columns that exist in both tables being referenced.  The query must prefix the CMP table to each column in the select (e.g. price_list.price_id) or else I would have expected a SQL error because the column was not qualified.    Very cool though.
 
-----Original Message-----
From: David Esposito [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 07, 2001 11:50 AM
To: [EMAIL PROTECTED]
Subject: RE: [JBoss-user] Problem with Custom finders ....

You actually can do a join with another table .. (however, you can't fetch any of the data from those tables as they are not part of the CMP fields) ... it does have a little hacky flavor to it though ... ;)
 
this is for my PriceListBean ... it does a join with the price_list_level table ...
 
   <finder>
    <name>findByCatalogItemIDByUnitIDByRetailerID</name>
    <query>,price_list_level
      WHERE catalog_item_id={0}
      AND catalog_item_unit_id = {1}
      AND price_list.price_list_level_id = price_list_level.price_list_level_id
    </query>
    <order>price_list_level_default, unit_quantity DESC</order>
   </finder>
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of John Moore
Sent: Thursday, June 07, 2001 2:35 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [JBoss-user] Problem with Custom finders ....


if you use a join you have to make sure that it is handled in a subselect since, I don't believe, you can modify the from clause in EJB 1.1 CMP.  Here is an example of an where we join between two tables.

<finder>
        <name>findExternalOrganizations</name>
        <query>account_no_in = {0} and ounit_parent_no_in is null and ounit_no_in != ( select ounit_no_in from account_tbl where account_no_in = {0} )</query>

        <order />
</finder>

-----Original Message-----
From: Grim Shieldsson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 07, 2001 10:06 AM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] Problem with Custom finders ....


No I didn't, under Bean Managed Persistence.  You do under CMP.
--- Ray <[EMAIL PROTECTED]> wrote:
> Hi again .... :-)
>
> Still working on my problem with customer finders
>
> Has anyone got an example of a cusotmer finder that
> uses SQL joins? This appears to be my problem.
>
> Did you have to define entity beans for the
> intermediate tables?
>
> Any examples would be much appreciated .... :-)
>
>
>
>
> ____________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
> or your free @yahoo.ie address at http://mail.yahoo.ie
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user


=====
Grim Shieldsson (James A Barrows)
Acting Chieftain of Clan StormWolf
Barbarian Freehold Alliance
Oppurtunity doesn't knock.  It only presents itself after you kick down the door.
--Kyle Chandler

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year!  http://personal.mail.yahoo.com/

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to