EJB design: How to access 2 tables from a Bean?

  1. How to access 2 tables from a Bean? (3 messages)


     I want to do select query which delas with 2 tables in the database.
    How do I do it thru' CMP beans ?
    Will I need to write 2 beans which maps 2 tables and then single
    deployement discriptor where I need to specify 2 bean entries ?
    I need to write SELECT clause. I'm using EJB2.0, WLS6.0
    and I don't have any relationship with beans. All I wanna do is,

        SELECT t1.id, t1.name FROM table1 t1, table2 t2
               WHERE t1.id = t2.id AND t1.type = 'T5S' AND t1.SeqNum = '1' "
                            AND t1.state= 'TX'"
    Wheather I need to use EJB QL ?
    How can I do the above ? any example, url, info ... is welcome.

    Advance thanx//
  2. U can create a view on the tables and write a single CMP on them
  3. if only query, dont use entity, just access database thru session bean.
  4. How to access 2 tables from a Bean?[ Go to top ]

    If you are updating the tables though, you have to make sure that the view contains all the not null columns.