how to handle multiple tables in one bean

Discussions

EJB programming & troubleshooting: how to handle multiple tables in one bean

  1. how to handle multiple tables in one bean (4 messages)

    Hi,
    I have two or three tables which i want to fetch my date through EJB
    so can any one help me to solve this
    any link or any help

    thanks
    vikassheelgupta@rediffmail.com
  2. your query is not quite clear. But if you are asking, if we can map a single entity bean to 2 or more tables, the answer is Yes, only through BMP(bean managed persistence)- where you decide on the persistence logic. If you are talking about entity relation ships, read articles on CMR(container managed relationships)
    HTH
  3. sir
    what i want to do is
    i am using CMP Bean and JDeveloper
    and i have two or more tables from where the date comes and shows in JSP page as per first ,last and next previous basis
    so my question is i am using single bean class and accessing data from one table
    now i am also include more tables so that other tables data can also see on another pages
    so how can i do that
    my mail id is vikassheelgupta at rediffmail dot com

    if u know about JDeveloper then i have one more problem can u tell me about this problem

    Error instantiating application 'current-workspace-app' at file:/D:/OraHome1/jdev1012/jdev/mywork/Safex/Safex-oc4j-app.xml: Error initializing ejb-module; Exception ejbCreate() method not found in bean-class model.partymas.PartymasBean

    thats another problem if u know about it
    pls tell me
    thanks
  4. Hi,
    I am sorry, but I am not sure if I understood what you really want to do. However, let me try answering you.
    You have multiple tables, from which you want to access data and show on a single JSP - if this is the case, create CMP beans for manipulating each table. Infact, if no insert/update is performed on tables you need not use CMP. But for the time being let us assume that you have CMP bean corresponding to each table. Now, from a session bean, invoke each bean using a findBy...(..) method - as the case may be. Now, using data from each bean, populate a Data transfer object( a simple Java bean, that can be used to transfer data from your session bean to servlet/jsp). Using this data transfer object, display dates on your jsp.
    Sorry, not much help on jdeveloper front.

    HTH
  5. hello sir,
    thanks for my help
    as i am new in EJB so thats why i face such a problem
    let me tell u what i want to do is
    i have two jsp pages from where different column value will be stored in database
    now i have some buttons like add ,modify ,delete, (<)for previous record (> ),for next button , first and last record
    now i have to implement EJB
    so in that case i have submitted my values in database through create()
    but if i want to delete or modify or find some records from the data base then how to configure that
    can i make differnent methods for each like one for delete and one for modify and for first record and for last record like that
    if this then how to call those methods with in my JSP pages
    if this happenes in that manner than what is the use of ejbRemove(),ejbStore() ejbLoad() methods

    and another question is how and where the data is persistent through EJB

    if we say that our database server is disconnected then can we able to store or retrieve values from there

    i am confused so tell me the solution
    if possible then pls give me ur mail id or contact no so that i can talk to you
    thanks once again
    thankyou very much for help