Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop EJB applications > Assembling access intents to EJB 2.x entity beans
Apply access intent policies to beans
We can apply an access intent policy to an application's entity beans through the assembly tool.
Container-managed persistence (CMP) developers can use access intent to provide hints on how the application server run time should manage the details of persistence without having to explicitly manage any of the persistence logic from within their application.
Use the access intent service is also an option for programmers who develop bean-managed persistence (BMP) entity beans. Because the only meaningful difference between BMP and CMP components is the mechanism that provides the persistence logic, BMP beans leverage access intent hints in the same manner as the EJB container manages accent intent for CMP beans. This ability becomes especially important when BMP entities and CMP entities want to share connections. BMP beans configured with the same concurrency as the CMP beans and implemented to the same isolation level mapping as the CMP can share connections.
Developers can apply access intent policies to BMP entity beans as well as to CMP entity beans. It is expected that BMP developers use only those access intent attributes that are important to a particular BMP bean. The access intent service interface is bound into the java:comp namespace for each particular BMP bean. The access intent policy retrieved from the access intent service is current from the time that the ejbLoad process is called until the time that the ejbStore process completes its invocation.
This is the preferred technique to define access intent policies. Method-level access intent is deprecated in v6.0.
Procedure
- Start an assembly tool.
- Optional: Open the Java EE perspective to work with Java EE projects. Click Window > Open Perspective > Other > Java EE.
- Optional: Open the Project Explorer view. Click Window > Show View > Project Explorer. Another helpful view is the Navigator view (Window > Show View > Navigator).
- Create a new application EAR file or edit an existing one.
For example, to change attributes of an existing application, use the import wizard to import an EAR file.
To start the import wizard:
- Select File > Import > EAR file > Next
- Select the EAR file.
- Create a WAS v6.0 type of Server Runtime. Select New to open the New Server Runtime Wizard and follow the instructions.
- In the Target server field, select WAS v6.0 type of Server Runtime.
- Select Finish
- In the Project Explorer view of the J2EE perspective, right-click Deployment Descriptor: EJB Module Name under the EJB module for the bean instance, then select Open With > Deployment Descriptor Editor. A property dialog notebook for the EJB project is displayed in the property pane.
- Select the Access tab.
- In the Access Intent for Entities 2.x (Bean Level) panel, select the name of the bean.
- On the right side of the Access Intent for Entities 2.x (Method Level) panel, select Add. The Add Access Intent panel displays.
- In the Access intent name field, select wsPessimisticUpdate from the drop-down list.
- Optional: Enter a Description to help you remember what this policy does.
- Optional: Change the Persistence Option setting
- Click Finish. The access intent policy for the entity bean is shown in the Access Intent for Entities 2.x (Bean Level) panel
Access intent policies for EJB 2.x entity beans
Use access intent policies for EJB 2.x entity beans
Assembling applications
Related
Access intent assembly settings
Access intent -- isolation levels and update locks