Query regarding EJB -QL --- Help me out

Hello, i have a basic question regarding QL
as such if we want findBYxxx() we provide a similar query in QL descriptor, this is ok..
but the problem is..
how can i proceed with query that retrieves rows from multiple tables (referential integrity)..
suppose i call retrieveRows() menthod on entity (cmp) from my view (jsp), then what code i have to write in retrieveRows() method of bean (cmp entity). and what has to be specified in the QL deploment Descriptor.
Please guide me with an example code (if possible) plzzzzz..
Thanks jaagy

This is an example of relation Street -> Town
Data-schema:
Town(
code Integer,
name String
Street(
code Integer,
name String,
town_code Interger
ejb-jar.xml fragment:
<entity>
            <ejb-name>StreetBean</ejb-name>
            <local-home>StreetHome</local-home>
            <local>Street</local>
            <ejb-class>StreetBean</ejb-class>
            <persistence-type>Container</persistence-type>
            <prim-key-class>java.lang.Integer</prim-key-class>
            <reentrant>False</reentrant>
            <cmp-version>2.x</cmp-version>
            <abstract-schema-name>host</abstract-schema-name>
            <cmp-field><field-name>code</field-name></cmp-field>
            <cmp-field><field-name>name</field-name></cmp-field>
            <primkey-field>code</primkey-field>
          <query>
                <query-method>
                    <method-name>findByTown</method-name>
                <method-params>
                    <method-param>java.lang.String</method-param>
                </method-params>
                </query-method>
                <ejb-ql><![CDATA[
                    SELECT OBJECT(s)
                    FROM street s
                    WHERE s.town.name = ?1
                    ]]>
                </ejb-ql>
            </query>
        </entity>
        <ejb-relation>
            <ejb-relation-name>Town-Street</ejb-relation-name>
            <ejb-relationship-role>
                <ejb-relationship-role-name>town-has-streets</ejb-relationship-role-name>
                <multiplicity>One</multiplicity>
                <relationship-role-source>
                    <ejb-name>TownBean</ejb-name>
                </relationship-role-source>
                <cmr-field>
                    <cmr-field-name>townStreets</cmr-field-name>
                    <cmr-field-type>java.util.Set</cmr-field-type>
                </cmr-field>
            </ejb-relationship-role>
            <ejb-relationship-role>
                <ejb-relationship-role-name>street-belongs-to-town</ejb-relationship-role-name>
                <multiplicity>Many</multiplicity>
                <cascade-delete/>
                <relationship-role-source>
                    <ejb-name>StreetBean</ejb-name>
                </relationship-role-source>
                <cmr-field>
                    <cmr-field-name>town_code</cmr-field-name>
                </cmr-field>
            </ejb-relationship-role>
        </ejb-relation>

Similar Messages

  • A Oracle sql query is needed, please help me out

    Hi,
    I have a table similar to scott.emp table and i should get first three recently joined employees salaries according to their joined date from each deptno
    output should like this:
    deptno firstempsalary secondemplsal thirdemploysalary
    10 xxx xxx xxxx
    20 xx xx
    30 xx xxx xxxx
    40 xx
    50 xx xxxx xxx
    60 xx xx
    70 xx
    it means that 70 dept having only one employee and 20 dept having only two employees and 10 dept having more than three employees but we should get only three recently joined employees salaries from 10 dept.
    Hope this is clear .. please give me a query to get this info ..
    oracle is 10g version
    great thanks in advance.

    select deptno,
    max(case jd_rank when 1 then salary end) firstempsal,
    max(case jd_rank when 2 then salary end) secondempsal,
    max(case jd_rank when 3 then salary end) thirdempsal
    from
    (select salary, deptno, row_number() over(partition by deptno order by join_date desc) jd_rank from emp)
    group by deptno
    Problem here is what to do when employees have the same join date? This example will arbitrarily choose their order and if, for example, three employees share the same (most recent) join date then they will arbitrarily be classed as "first", "second" and "third". If four employees join at the same time, one of them will be ignored at random!
    Edited by: user10548434 on 03-Dec-2008 06:27

  • Query regarding insert statement ( help me)

    how to insert 10 rows at a time???
    wheather it is possible??

    Hi user648016!
    What you are looking for is called "Multi Table Insert".
    INSERT ALL
    INTO sales (prod_id, cust_id, time_id, amount)
    VALUES (product_id, customer_id, weekly_start_date, sales_sun)
    INTO sales (prod_id, cust_id, time_id, amount)
    VALUES (product_id, customer_id, weekly_start_date+1, sales_mon)
    INTO sales (prod_id, cust_id, time_id, amount)
    VALUES (product_id, customer_id, weekly_start_date+2, sales_tue)
    INTO sales (prod_id, cust_id, time_id, amount)
    VALUES (product_id, customer_id, weekly_start_date+3, sales_wed)
    INTO sales (prod_id, cust_id, time_id, amount)
    VALUES (product_id, customer_id, weekly_start_date+4, sales_thu)
    INTO sales (prod_id, cust_id, time_id, amount)
    VALUES (product_id, customer_id, weekly_start_date+5, sales_fri)
    INTO sales (prod_id, cust_id, time_id, amount)
    VALUES (product_id, customer_id, weekly_start_date+6, sales_sat)
    SELECT product_id, customer_id, weekly_start_date, sales_sun,
    sales_mon, sales_tue, sales_wed, sales_thu, sales_fri, sales_sat
    FROM sales_input_table;
    For more information about this look here:
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9014.htm#i2163698
    Hope this helps!

  • Posted this query several times but no reply. Please help me out

    Hi all,
    How to know whether a servlet had completely sent its response to the request.
    The problem what i am facing is, I send response to a client's request as a file.
    The byte by byte transfer happens, now if the client interrupts or cancels the operation, the response is not completed.
    At this stage how to know the response status. I am handling all exception, even then I am unable to trap the status.
    Please help me out.
    I have posted this query several times but no convincing reply till now. Hence please help me out.
    If somebody wants to see the code. I'll send it through mail.
    regards
    venkat

    Hi,
    thanks for the reply,
    Please check the code what I have written. The servlet if I execute in Javawebserver2.0 I could trap the exception. If the same servlet is running in weblogic 6.0 I am unable to get the exception.
    Please note that I have maintained counter and all necessary exception handling even then unable to trap the exception.
    //code//
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.security.*;
    public class TestServ extends HttpServlet
    Exception exception;
    public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException, UnavailableException
         int bytesRead=0;
         int count=0;
         byte[] buff=new byte[1];
    OutputStream out=res.getOutputStream ();
    res.setContentType( "application/pdf"); // MIME type for pdf doc
    String fileURL ="http://localhost:7001/soap.pdf";
    BufferedInputStream bis = null;
    BufferedOutputStream bos = null;
    boolean download=false;
         int fsize=0;
         res.setHeader("Content-disposition", "attachment; filename="+"soap.pdf" );
    try
                   URL url=new URL(fileURL);
         bis = new BufferedInputStream(url.openStream());
         fsize=bis.available();
         bos = new BufferedOutputStream(out);
    while(-1 != (bytesRead = bis.read(buff, 0, buff.length)))
              try
                        bos.write(bytesRead);
                        count +=bytesRead;
                        bos.flush();
                   }//end of try for while loop
                   catch(StreamCorruptedException ex)
                        System.out.println("Exception ="+ex);
                        setError(ex);
                        break;
                   catch(SocketException e)
                        setError(e);
                        break;
                   catch(Exception e)
                        System.out.println("Exception in while of TestServlet is " +e.getMessage());
                        if(e != null)
                             System.out.println("File not downloaded properly"+e);
                             setError(e);
                             break;
                        }//if ends
                   }//end of catch for while loop
    }//while ends
              Exception eError=getError();
              if(eError!=null)
                   System.out.println("\n\n\n\nFile Not DownLoaded properly\n\n\n\n");
              else if(bytesRead == -1)
              System.out.println("\n\n\n\ndownload \nsuccessful\n\n\n\n");
              else
              System.out.println("\n\n\n\ndownload not successful\n\n\n\n");
    catch(MalformedURLException e)
    System.out.println ( "Exception inside TestServlet is " +e.getMessage());
    catch(IOException e)
    System.out.println ( "IOException inside TestServlet is " +e.getMessage());
         finally
              try
         if (bis != null)
         bis.close();
         if (bos != null)
         {bos.close();}
              catch(Exception e)
                   System.out.println("here ="+e);
    }//doPost ends
    public void setError(Exception e)
         exception=e;
         System.out.println("\n\n\nException occurred is "+e+"\n\n\n");
    public Exception getError()
              return exception;
    }//class ends
    //ends
    regards,
    venakt

  • Order by problem in my query - plz help me out

    Dear all,
    I have a query like this,
    Select Booking_No, Get_Bl_Number (Booking_No) Bl_No, Depot_Code
    From Booking_Table
    Where Booking_Mode = 'B'
    Order By Depot_Code, Bl_No, Booking_No
    i need the output like NULLs of Bl_No should come first..ie.,
    DEPOT_CODE BL_NO BOOKING_NO
    DEPOT01 BOOKING01
    DEPOT01 BL01 BOOKING02
    DEPOT03 BL04 BOOKING03
    DEPOT04 BOOKING04
    DEPOT05 BL05 BOOKING06
    since am using the function to get the Bl_No, am not getting the NULLs first...kindly help me out
    Thanx and Rgds,
    M Thiyagu

    You can use like this:
    Order By
       Depot_Code,
       Bl_No nulls first ,
       Booking_No

  • Hi i am new to SCN. I want a help regards SAP-PM . Where to post any query regards SAP PM

    Hi i am new to SCN. I want a help regards SAP-PM . Where to post any query regards SAP PM

    Please check this link SAP Portfolio and Project Management (SAP RPM, cProjects) and cFolders
    Please check scn index to find relevant forum link.
    SCN Site Index

  • HT1338 I have a macbook Pro i7 mid november 2010. I am wondering if i can exchange my notebook with the latest one. Can anyone help me out with this query please.

    I have a macbook Pro i7 mid november 2010. I am wondering if i can exchange my notebook with the latest one. Can anyone help me out with this query please.

    You can sell your existing computer using eBay, Craigslist or the venue of your choice. You could then use the proceeds to purchase a new computer.

  • Hi guys can someone help with a query regarding the 'podcast app' why do they not have all the episodes that relate to one show available why only half or a selected amount

    Hi guys can someone help with a query regarding the 'podcast app' why do they not have all the episodes that relate to one show available why only half or a selected amount

    THanks...but some days they have all the episodes right back to the very first show...ive downloaded a few but they are only available every now and then which makes no sense...why not have them available the whole time ??

  • Hi, i was wounding if anyone would help me get information on the company regarding the acquisition of, beats by dre, could someone please help me out as i am doing a college report on this and need some good sources of information

    hi, i was wounding if anyone would help me get information on the company regarding the acquisition of, beats by dre, could someone please help me out as i am doing a college report on this and need some good sources of information

    Try a search with Google.
    Why should we do your homework for you?

  • Hi Guys, Can i use Nokia Blutooth Headset with iphone 4, please help me out.  Regards

    Hi Guys,
    Can I use Nokia Bluetooth Headset with iphone 4, please help me out. 
    Regards
    Parveen

    Hi sausage,
    Unless you can find out the Apple ID and password of the previous owner, there is nothing you can do to remove the previous user's information. Return it for a refund.
    Sorry,
    GB

  • Regarding the wireless problem of my T60. Hope there is someone who can help me out. Thx.

    I have read some of the posts and i found out that some of the Thinkpad users have the problem of unable to connect wireless network using Access Connection but not Window wireless network connection. For my case, i have connect the network with both of them. In fact, when i use either one to connect, the other would be connected too.
    The problem is, sometimes when i use my wireless network, my wireless would be switched off automatically, and the wireless light is then off, and after that i cannot switched the wireless on again. I tried on it using access connection, failed. I tried Fn+F5 to on it, but no matter how many times i click on 'on', there would not be any response. The only thing i can do after this is to restart to laptop.
    I called Lenovo Support to help me solve the problem, but still failed. The first time they asked me to installed some drivers and reinstall my Intel(R) Pro/Wireless 3945ABG Network Connection. These files included 79uj29us which is a bios update, 7kwc50ww which is the wireless driver installation, 7tvu12ww which is the hotkey driver update, and last 7tku03ww, a power management driver update. But the problem remains. The 2nd time i called, they asked me to uninstall my Access Connection and use window wireless connection as they may cause conflict to each other, and they asked me to uncheck the option of 'Allow this computer to turn off this device to save power' in the power management of wireless drive in device manager, but problem persists. The last time i called the technician and he said they only can check if it is a hardware problem and there most probably be nothing else they can do for my softwares and drivers, and he also believed that it might be the network configuration of my service provider that cause the problem, but i personally do not think so as it is quite hard to believe that the my service is switching off my wireless hardware and i have other laptop in my house too but they do not experience this problem.
    Last night i discovered something new, when the wireless is off automatically again, i ran a test on the the wireless device using PC Doctor, for PCI express status test, it passed, for the wireless connectivity and signal strength test, results showed there was 'no connection', when it comes to network link test, it showed 'internal error', the TCP/IP network connection test showed failed. Then i restarted it and ran the test with the wireless switched off by my self, the PCI express status test passed too, but the remaining four test all showed 'no connection'.
    I really hope if there is someone there to help me out to solve the problem or to enlighten me what the real problem is, could it be software or hardware problem, or could it be other problems like registry or what? I greatly appreciate if anyone can help me to solve this. Thanks alot.
    Message Edited by cat_felix on 06-13-2008 09:54 PM
    Message Edited by cat_felix on 06-13-2008 09:55 PM
    Message Edited by cat_felix on 06-14-2008 04:15 AM

    I have uninstalled my Access Connection, but this problem seems to persist. IBM technician have changed the wireless card of my T60, the first few days after it was changed was very fine, no problem at all. About a week later, the problem occured again, and it happened quite frequently after that occurence. Now i really have no idea what is the cause and how to solve it. Will be greatful if there is anyone that can help me.

  • URGENT: REGARDING ROUTING REPORT(plzz help me out)

    Hi,
    I am making a report in which i have to display the stock during the routing i.e. in CA03 we get to know which are the operations are implemented on a material. the requirement is if there are 50 pcs of material are in 1st operation and only 10 materials are able to reach next stage of operations ,then how many pcs of a material are left among them? i want to know which are the tables used for these qtys as i am checking that in CA03  the values are in structure and i want to know in which tables these quantities to be present.
    plzz help me out as it is really urgent and help will be definitely rewarded.
    Edited by: ric .s on Apr 1, 2008 7:45 AM

    hi,
    can anybody tell me which are the tables used in the routing?

  • Could anyone help me out here regarding frame rate?

    Hi, everyone,I need help with a dynamic frame rate issue,
    I have created this spinning diamond flash with a dynamic frame rate controlled by the mouse cursor.
    it spins from the right to the left if the cursor is at the left side of the diamond and vice verse, and also the further away the cursor is from the middle of the diamond, the faster it spins.
    it works perfectly awesome in Firefox and by itself, but when it's in IE, the cursor loses control of frame rate, so it spins at the highest frame rate regardless where the cursor is at.
    I used nextFrame(), prevFrame() to do the winding and rewinding job, and frame rate gets changed in ENTER_FRAME.
    I've heard some say that IE ignores frame rate per frame? is it true? if so, how do I fix it?
    Could anyone please help me out with this issue?it only happens in IE.

    please don't cross-post.  let's keep this discussion on the general flash forum.

  • Help me out in learning EJB

    hai ..
    i'm new to this forum.
    i started learning EJB. please help me out

    Get the book by Ed Roman named Mastering EJB.
    It is available as a free download on www.theserverside.com

  • Query regarding passing of an internal table data to a form

    Hi All,
    Please help me out regardingmy query.
    I have a standard driver program and a Z form(SAPSCRIPT). Suppose i have an RFQ and it has number of line items in it, I need to fetch them all for a RFQ and then pass to the form and as this functionality is not available in the driver program, i want to  achieve via a subroutine pool. Passing of the data via the itcsy structure and all or by calling a write_form and passing the element to it.
    Can u all let me know whether i can pass the data ie., multipe records of data to form from a program otehr than the driver program?
    Regards
    Priya

    Hi Priya,
                  Why you need separate subroutine, you will find all the required data in the driver program itself.
    Just identify the Standard Subroutine in NACE tcode,
    For all Standard Driver program is SAPFM06P
    For RFQ
    Application type is 'EA'
    Output types are
    1) New
    2) Reminder
    3) Quotation rejection
    Further standard subroutines used for each output type are
    1)ENTRY_NEU  -  New
    2)ENTRY_MAHN - Reminder
    3)ENTRY_ABSA - Quotation rejection
    and the above mentioned subroutines get the data required for the corresponding sapscript
    RFQ Docno :- ekpo-ebeln
    RFQ Item   :- ekpo-ebelp
    Regards
    Bala Krishna

Maybe you are looking for

  • How to open file in Quicktime Player when it shows gray/unavailable?

    How do I erase audio on idvd project?  Looking to separate audio from video, and apply new audio. Using 10.6.8 macbook air, Processor 1.4 GHz Intel Core 2 Duo.   Using imovie 11, 9.0.4, idvd 7.1.2.  Could not import to imovie, file would not appear.

  • Mail: no content in messages in one folder - disappeared

    I have one mailbox that lists the mail in the folder but has no content in the text. Text encoding is automatic - no idea why only one mailbox has this problem. I can see the mail, the subject line, to and from, and if I open a message it's blank. If

  • HT204053 i set up my icloud and it keeps  saying account not verified

    I just downloaded the os6  and i also just tried to do the updates with icloud.  but now it keeps telling me could not verify the account, to check my email for instructions.  i check the email, had to reset my password and then nothing, can't get th

  • Communication error with lbp 3300

    today me buy new printer canon lbp 3300 me attached with time capsule its not working its give messeage communication error how can i solve this problem

  • MacBook Pro and G3 Airports...

    Side by side - the older machine (G3, 500mhz) shows maximum signal level (Internet Connect 1.4.2) from a nearby network. My brand new machine (MacBook Pro 2.1GHz Intel) shows almost no signal level at all with the same network selected (Internet Conn