Use of EJB 2.x entity beans
Although the use of EJB 2. x entity beans in WebSphere Commerce is possible, it is not recommended.Local interfaces and Container-Managed Relationships, which are the two main features provided by the EJB 2. x specification, will not benefit WebSphere Commerce users for the following reasons:
- Local interfaces
- The performance increase gained by local interfaces is already obtained through the WAS feature that allows pass-by-reference. For more information on pass-by-reference, see the Object Request Broker tuning guidelines topic in the WAS information center.
- Container-Managed Relationships
- To minimize complexity in the object model, rather than using the Container-Managed Relationships, an object relationship between enterprise beans can be established by adding explicit getter methods to the enterprise beans that return access beans.
If you choose to create EJB 2. x entity beans, you should be aware of the following limitations and stipulations:
- All entity beans referenced by EJB Query Language (EJBQL) must be in the same EJB module.
- All entity beans referenced in EJBQL must be at 2. x level. EJBQL cannot reference entity beans which are still at EJB 1.1 level.
- Since most WebSphere Commerce EJBs are at EJB 1.1 level, you cannot reference most WebSphere Commerce entity beans from 2. x finders.
- WebSphere Commerce uses access beans in its programming model, and access beans do not support local interfaces and Container-Managed Relationships. To use local interfaces, instead of using access beans, perform home lookup directly and cache it yourself for performance purposes.
- To use optimistic locking, implement optimistic locking as described in Optimistic locking with the following exceptions:
- You must extend ECAbstractEntityBean.
- You must set the access intent to wsOptimisticPredicate.
Related concepts
WebSphere Commerce enterprise beans
Persistent object model
Extending the WebSphere Commerce object modelRelated tasks
Create new entity beans