EJB & Databse

Discussions

EJB design: EJB & Databse

  1. EJB & Databse (3 messages)

    I am a novice in EJB.So I have something confused.If an EJB maps to a record in database table,so how can I do SQL query by EJB?

    Threaded Messages (3)

  2. EJB & Databse[ Go to top ]

    There are 2 ways to get the records from the database using the entity beans 1) You can us Bean managed persistence or 2) container managed fields. In the Bean managed fields u can query the database using ejbmethods like ejbFindByPrimarykey(), ejbFindByLastName() etc..When you use contained Managed persistence then you have to give the mapping fields during the deployment so that the container automatically generate the sql for you.
  3. EJB & Databse[ Go to top ]

    There are 2 ways to get the records from the database using the entity beans 1) You can us Bean managed persistence or 2) container managed fields. In the Bean managed fields u can query the database using ejbmethods like ejbFindByPrimarykey(), ejbFindByLastName() etc..When you use contained Managed persistence then you have to give the mapping fields during the deployment so that the container automatically generate the sql for you.

    By
    Narendra
  4. EJB & Databse[ Go to top ]

    thank you for your reply.But I also have the question.

    Suppose in databse there are two tables named A and B.
    if I use session bean or other method to connect database directly,I can write a sql such as "select a.name,b.code from A a,B b where a.id=b.id".The question is how can I map this query in Entity Bean?