More Effective Entity Bean (new ENTITY BEAN's performance seven (EJB2.0))

zhaozj2021-02-11  220

There are many fuds (Fear, Uncertainty, Doubt) in the industrial. Many institutions are inappropriate to use them, resulting in performance issues. Here are some TIPS and TRICKS to make your Entity Bean have higher performance.

The 1.ENTITY bean should not be called directly by a remote client, but should be called in the same process. In view of this, you should call them through local interface, not Remote Interface.

2. Use your container as possible as possible. If your bean is read-only, let your container let them permanently caching. If they are maximized read or read and write, many containers have algorithms to handle this situation. Remember: Memory is cheap.

3. Make sure your transaction on your server is getting better and better, and encapsulate the Entity Bean operation you want to do in the transaction. This is important because JDBC happens in the beginning and end of the transaction. If you use a transaction every time get / set, you have done SQL HIT during each method. Session and Entity Beans will be released with the required container management transaction attributes. This will create a transaction that encapsulates all Entity Beans in the same transaction.

4. Try to use CMP as much as possible. CMP is born higher than BMP performance.

5. If you need to access all the data of your Entity Bean in each transaction, don't take out the data of all your fields when you first access your bean: You can use BMP to use BMP to Fine- Tuning your JDBC code; or if your container tool allows, you can use the CMP's way to Lazy-load your field.

6. If you use CMP, let your container for a batch of your fields. For example, WebLogic has the terminology of Field Groups. This lets you define Groups Offields (or even cross-relationships) to persist together, reduce the required SQL quantity.

7. If you use CMP, for your container tool to force your finder method to automatically load your bean, not letting Finder and Loading occur in two separate SQL expressions. The only thing you should not use this method is that you are not ready to read data from your EntityBean (such as a Set field, not a get field).

Use the above method to adjust your performance, you can create a fine-grained Entity bean that is scheduled to make a single column in the database, and modeling the coarse granular Entity Bean of complex data relating to multi-table.

转载请注明原文地址:https://www.9cbs.com/read-5212.html

New Post(0)