• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Al Hobbs
  • Piet Souris
  • Himai Minh

usage of entity and session beans in combination?

Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If there is a need to do some accounts complex calculation process with multiple table data and multiple records then can I do everything with entity beans? (assume this process can be done with regular Java and JDBC API's).

Here there is process and multiple tables updation. So can I put process logic in a session bean and data retrival and updation logic in entity bean of the same ejb-jar file.

Can this process done in the below way
(1) I call session bean method to start process from client.
(2) session bean calls entity bean via JNDI to get tables data.
(3) entity bean retrives data and send back data to session bean as primary key class objects.
(4) session bean processes data and changes the data of primary key objects and then sends the primary key objects back to entity bean.
(5) entity bean updates the tables and returns control to session bean.

is this functionality is correct? Here assume entity bean is of type CMP.

Thanks & Regards,
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is normally how it works. Especially with EJB 2.0, local views have been introduced. This allow for the Facade pattern, where there is usually one session bean which offers both remote and local views, and entity beans are managed locally. This also allows for CMR, as one of the requirements is that the return type for a CMR field should be a local component interface.
Getting married means "We're in love, so let's tell the police!" - and invite this tiny ad to the wedding:
the value of filler advertising in 2021
    Bookmark Topic Watch Topic
  • New Topic