Persistence of EJB.

Can anybody please tell what is the actual meaning of persistence and how EJB will provide persistence.

Comments

  • Are you talking about Bean Managed Persistence and Container managed Persistence by any chance? is yes read:

    There are two methods of designing your entity beans BMP and CMP,

    when You are using BMP You need to handle all the Database connections ,retrieval queries etc.

    But in case of CMP all you need to do is leave this upto the container to do it( so ur ejbLoad() , ejbStore() methods are left blank), wat u need to do is just take care of all this when you are Deploying the EJB.
  • Basically how many classes are required to be written when writing any of EJB's?
    Which are the classes?

    : Are you talking about Bean Managed Persistence and Container managed Persistence by any chance? is yes read:
    :
    : There are two methods of designing your entity beans BMP and CMP,
    :
    : when You are using BMP You need to handle all the Database connections ,retrieval queries etc.
    :
    : But in case of CMP all you need to do is leave this upto the container to do it( so ur ejbLoad() , ejbStore() methods are left blank), wat u need to do is just take care of all this when you are Deploying the EJB.
    :

  • it all depends.. what type of EJB are you building?
    You will require to be a little more specific

    Essential classes are
    1)Bean Class(Session or entity)

    interfaces
    1) Home interface(local remote)
    2) Remote Interface(local remote)

  • : it all depends.. what type of EJB are you building?
    : You will require to be a little more specific
    :
    : Essential classes are
    : 1)Bean Class(Session or entity)
    :
    : interfaces
    : 1) Home interface(local remote)
    : 2) Remote Interface(local remote)
    :
    :

    Classes that I must write for a simple EJB?
    For session beans?
    For Entity beans?
    Do I have to write 4 classes or 3 classes?
  • See dosent matter what type of EJB u r developing
    THREE THINGS ARE REQD(on the server side):
    1) Bean class
    this class implements SessionBean/EntityBean interface again depending on the type of bean you are developing.
    2) Home Interface
    This is required and has the create() method(ie, life cycle methods)
    3)Remote Interface
    Contains "declarations" for the bean methods.


  • : See dosent matter what type of EJB u r developing
    : THREE THINGS ARE REQD(on the server side):
    : 1) Bean class
    : this class implements SessionBean/EntityBean interface again depending on the type of bean you are developing.
    : 2) Home Interface
    : This is required and has the create() method(ie, life cycle methods)
    : 3)Remote Interface
    : Contains "declarations" for the bean methods.
    :
    :
    :

    Any simple example for all these 3 classes? Like if I have student as my database table what would be the structure of each classes? If possible plz explain. Thanks in advance.
  • there is only one class and 2 interfaces
    I dun knw the exact question you want me to solve but this will help


    public class StudentBeanExample implements EntityBean
    {


    String name; /*say name of the student */
    String elective;
    int class;
    int section;
    .........
    .........
    /* these methods are reqd */
    public void ejbCreate(/* can have args here */)
    {}
    public void ejbLoad()
    {
    /*perform load operation to update your local variables to
    maintain consistency with the DBMS record*/
    }
    public void ejbStore()
    {
    /*perform load operation to update your dbms to
    maintain consistency with the local variables record*/
    }
    public void ejbRemove()
    {
    }
    other such methods you need to code
    ....
    //Your own methods go here
    */
    }// end of class

    then you create a remote interface

    public interface Student extends EJBObject
    {
    /* put in declarations all the methods that ur Bean class
    requires leaving out the predefined methods(having the ejb prefix) */
    }

    then u code your home interface

    public interface StudentHome extends EJBHome
    {
    public void create(/* can have args here */)

    }

    Now replicate home and remote interfaces so that u have a local and remote for both the interfaces and u are through with it.

  • As you have told to write 3 classes how about the other three classes?
    Local home interface,LocalHome, Local interface.
    What does these class contain? What should i write in this?
    I have got to know what will be there in

    Remote interface, Home interface and EJB classes.



    : there is only one class and 2 interfaces
    : I dun knw the exact question you want me to solve but this will help
    :
    :
    : public class StudentBeanExample implements EntityBean
    : {
    :
    :
    : String name; /*say name of the student */
    : String elective;
    : int class;
    : int section;
    : .........
    : .........
    : /* these methods are reqd */
    : public void ejbCreate(/* can have args here */)
    : {}
    : public void ejbLoad()
    : {
    : /*perform load operation to update your local variables to
    : maintain consistency with the DBMS record*/
    : }
    : public void ejbStore()
    : {
    : /*perform load operation to update your dbms to
    : maintain consistency with the local variables record*/
    : }
    : public void ejbRemove()
    : {
    : }
    : other such methods you need to code
    : ....
    : //Your own methods go here
    : */
    : }// end of class
    :
    : then you create a remote interface
    :
    : public interface Student extends EJBObject
    : {
    : /* put in declarations all the methods that ur Bean class
    : requires leaving out the predefined methods(having the ejb prefix) */
    : }
    :
    : then u code your home interface
    :
    : public interface StudentHome extends EJBHome
    : {
    : public void create(/* can have args here */)
    :
    : }
    :
    : Now replicate home and remote interfaces so that u have a local and remote for both the interfaces and u are through with it.
    :
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories