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 WebSphere Application Server feature that allows pass-by-reference. For more information about pass-by-reference, seeObject Request Broker tuning guidelines topic.
- 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, we 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, we must perform home lookup directly and cache it yourself for performance purposes.
- To use optimistic locking, we must implement optimistic locking as described in Optimistic locking with the following exceptions:
- We must extend ECAbstractEntityBean.
- We must set the access intent to wsOptimisticPredicate.
Related concepts
WebSphere Commerce runtime framework enhancements
WebSphere Commerce enterprise beans
Persistent object model
Extending the WebSphere Commerce object model
Related tasks
Working with enterprise beans
Adding new EJB projects