Is it possible to have a business method which have database calls to access and update some other related tables, in a CMP entity bean.
Performance wise, which design will be better, either a CMP bean with this type of business methods or BMP entity beans?
The question you posted has to parts to it. The first is that when you want to access other tables which are not entity beans or the need was not there to make them entity beans then what should one do. Is this proper as per design/performance. The answer is that you have no other option but to undertake a JNDI lookup for a datasource and update that specific table.
The other question you posted that design/performance wise what type of bean should this be. Should it be a BMP or a CMP. The Answer is that an entity Bean must be a CMP always until and unless it can be justified that a BMP is required
You require a BMP only when (As given by Weblogic Documentation)
Possible scenarios where you may need bean-managed transactions are:
You must define multiple transactions from within a single method call. WebLogic Server demarcates transactions on a per-method basis; if you require multiple transactions in a single method call, you must use bean-managed transactions.
Note: However, keep in mind that if your EJBs use multiple transactions in a single method call, it is still better to break the method into multiple methods, with each one having its own container-managed transaction.
A single transaction must "span" multiple EJB method calls. For example, one method begins a transaction, and another method commits or rolls back the transaction. In general, this practice should be avoided where possible since it requires detailed information about the workings of the EJB object. If it is required, you must use bean-managed transaction coordination, and you must coordinate client calls to the respective methods.
[This message has been edited by Rahul Mahindrakar (edited September 11, 2001).]