Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

usage of entity and session beans in combination?

 
yamini nadella
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • 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.
 
alzamabar
Ranch Hand
Posts: 379
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic