Design of entity beans

Discussions

EJB design: Design of entity beans

  1. Design of entity beans (2 messages)

    Hi all,
    I want to handle the one to many relationship of entity beans in a traditional way. Meaning when i create a new master entity, i would like the user to populate all the detail entities also, before creating the master record in the database.

    I have designed the master and detail entity as entity beans. There is a master data entry page which has a 'Add details' button. This button click will pop up a new page to enter the detail data.

    I want to create both the entity beans only when the user finally confirms by clicking on 'Submit' button of the master data entry page. My problem is till i finally create the master and detail entity beans, i need to cache/store the data specifically the detail entity collection entered by the user.

    How and where do i store the detail entity data?

    Regards
    Srividhya

    Threaded Messages (2)

  2. Design of entity beans[ Go to top ]

    Hi,
      I think you should read 12-15 chapters of Matering EJB which is available at www.theserverside.com and freely downloadable.
      that will solve your problem....Moreover, I can give a bit hint like you need to make a stateful sesion bean also for this purpose. When user goes to the next page to enter the detail populate you header entity bean and store it in a the session bean and then let the user enters the detail.
    When user will finish the detail then retreive the entity bean object from the session bean and store that into the table.
    The same example is in that book...Go thru that.
    My mail id is [email protected]
    Bye

    Vicky
  3. Design of entity beans[ Go to top ]


    I think, you can follow the following idea.

    1. Design a java bean, at the first page.
    This page must be having all the fields that is collected from your jsp pages. populate the bean fields and keep it in the session.

    2.when customer finishes the operation, update the data in the database.

    3. if the customer going back to the previous page, you can retreive the bean from the session and can use the values to populate the fields.

    4. but, keeping the java bean in the websession will make the presentation layer too big.(particularly, if you have so many pages.)

    5. so keep the java bean in the ejb side as java object and retrieve it every time customer moves to next page.

    6. by this design you can keep your websession as thin, as well the data will persist upto the session is live.

    if you have any doubts, pls. get back to me at [email protected]