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
andAccessBean
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With