The WebLogic deployment descriptors for container managed persistent beans allows applications to use a feature for automatic database sequence (key) generation. When using this feature, a WebLogic application does not have to include code for generating the next sequence key when creating CMP EJB objects. When migrating WebLogic applications that include automatic sequence generation, application code must be added to generate the sequence identifier for new entries.
The weblogic-cmp-rdbms-jar.xml file contains information for entity EJBs that
use WebLogic RDBMS based persistence.
This rule scans for configuration of the WebLogic automatic-key-generation elements and provides migration
information for the Oracle generator type.
This example shows an element that will be flagged by this rule:
The generator-name entry indicates the name from the Oracle DUAL table to use to generate the next sequence.
For example, given a generator_name of sequence_id, the
following SQL statement can be used to get the next sequence number.
If this rule flags entries in your weblogic-cmp-rdbms-jar.xml deployment descriptor, you will need to take steps to manually modify your EJB code to create keys. These steps need to be taken before regenerating your EJB stubs for WebSphere Application Server. The following examples outline a potential migration path.
ejbCreate and ejbPostCreate methods of the entity bean.ejbCreate and ejbPostCreate methods.create method of the EJB Home.create() method is called to pass the next sequence number.The following high-level examples show how to replace the functionality of the Oracle auto-generated key logic. You will need to write similar code for each CMP bean that uses Oracle auto-generated sequence numbers. You can create utility help classes to combine common logic that generates the sequence numbers for each bean.
ejbCreate and ejbPostCreate methods of the entity bean.Before:
After:
ejbCreate method.create method of the EJB Home.Before:
After:
create() method is called to pass the next sequence number.