Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EntityBean, SessionBean, databean and accessbean

I have been trying to learn about the Java beans in WebSphere Commerce but I got really confused. Please help me out. I need to know:

What is the difference between EntityBean, SessionBean, DataBean and AccessBean and how do they compare?


Though I found the difference between Session and Entity, and between Access and Data, I fail to understand how they are all related to each other.

All the help would highly be appreciated.

like image 595
Just_another_developer Avatar asked Mar 19 '14 10:03

Just_another_developer


1 Answers

The entity bean represents a java bean which is coded by EJB specification and this java class is used to identify a record in a table. Session bean is also a java bean following the EJB specification ; but this bean can be considered equivalent to a java class which has business logic with or without interacting with entity bean(i.e DB Data). Therefore a Session bean e.g ProcessRegistrationBean will act on a entity bean e.g PersonBean.

Now, for the second part of the question on what is access and databean : these two beans are extensions of Entity beans provided by Websphere application providing convenient access to the entity beans hiding the complexity of JNDI lookup and home/remote interface methods of EJB spec.
This means that if you want to get a user's info, you can easily do so as just creating the UserAccessBean(which is generated from entity bean for user) via it's no arg constructor and then initialize by setting the user id. AccessBean behind the scenes uses home interface to access remote interface and all those EJB stuff happens without you need to know them explicitly - therefore making it easier for the developer.

Databean are extensions of its corresponding access beans i.e UserDataBean extends UserAcessBean.

The suggested use of AccesBean is in the java layer e.g SessionBean (this also means you don't have to deal with entity bean directly ) and DataBean in the JSP layer. This is how all these are related

like image 194
kbk Avatar answered Nov 14 '22 09:11

kbk