• 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
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic