When I want to add/remove a record from database, should I use the methods directly from Entity Bean or I should use a Session Bean to create some methods which will call the methods in the Entity Bean?

Alex Chaffee

It depends :-)

Usually you're fine just calling the EB methods (actually, create, and sometimes remove, would be called on the EJBHome). Use the SB if you have other things you want to do at the same time, like adding/removing other dependent entity beans, or logging the action, or performing additional validation.

See also Should I use Entity Beans for all database tables, even though they may have complicated relations and joins? Or should I just use them for frequently-used and simple tables such as account info?

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact