Win a copy of Spring Boot in Practice this week in the Spring forum!
  • 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 ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • 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,
Yamini.
 
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic