问题
I am confused about creating EJB
I have seen many samples of EJB on the internet and also sample project in which an EJB is developed using SessionBean , EJBObject and the EJBHome interfaces. In some other examples EJB is created without these interfaces and using only one or two interfaces e.g. if its locally accessible, javax.ejb.Local interface is used while for remotely access javax.ejb.Remote is used.
So i am confused about creating EJB. What is the difference between these two type?
I know that first one is implementing EJB for remote Access but the other one is confusing me
Please Help Me...!!!
回答1:
EJBHome and EJBObject are from older versions of EJB (before EJB 3.0).
You can igore them completely.
EJB 3.0 is quite straightforward and simple compared to the older versions.
回答2:
These are pre EJB 3.0 as seen in javadoc: http://docs.oracle.com/javaee/6/api/javax/ejb/package-summary.html
javax.ejb.EJBObject
Enterprise beans written to the EJB 3.0 and later APIs do not require a remote interface that extends the EJBObject interface. A remote business interface can be used instead.
javax.ejb.EJBHome
Enterprise beans written to the EJB 3.0 and later APIs do not require a home interface.
So if you are starting from scratch now, focus on learning the below as they are relevant in ejb 3.1
javax.ejb.Local
javax.ejb.Remote
javax.ejb.LocalBean
Here is a nice answer exaplaining the differences: https://stackoverflow.com/a/10896403/1418643
来源:https://stackoverflow.com/questions/13420344/ejb-creating-using-sessionbean-ejbobject-and-ejbhome-interfaces