Справочник Пользователя для IBM SG24-6320-00

Скачать
Страница из 306
 Chapter 8. Post-migration steps 
151
Draft Document for Review July 28, 2004 7:33 pm
6320ch_DEV_post_migration.fm
Where 
x.y.z
 denotes the subsection number in the EJB 1.1 specification in 
which the use of 
java.rmi.RemoteException
 deprecation for the relevant method 
is mentioned. For 
ejbCreate
 and 
ejbPostCreate
 this will be 9.2.3 and 9.2.4, 
respectively.
Other methods, such as ejbLoad, violating this requirement will result in the 
following error in the Tasks panel:
Exception RemoteException is not compatible with throws clause in 
ECEntityBean.<methodName>
Where 
<methodName>
 is the name of the violating method. This is caused by the 
fact that EJBs created for use with WebSphere Commerce should extend from 
the 
ECEntityBean
 class. This class already defines some of the EJB methods 
without the 
java.rmi.RemoteException
 in the 
throws
 clause. If the extending 
class then declares the 
java.rmi.RemoteException
 in its 
throws
 clause, it 
broadens the signature of the method, which is not allowed in Java.
Match ejbPostCreate and ejbCreate methods
Both EJB 1.0 and 1.1 specifications require that each 
ejbCreate
 method has a 
matching 
ejbPostCreate
 method. However, VisualAge for Java V3.5.3 did not 
enforce this requirement. After importing your EJBs into WebSphere Studio 
Application Developer V5.1.1, you must ensure that this requirement is fulfilled 
for all of your entity beans.
If an 
ejbCreate
 method exists without a matching 
ejbPostCreate
 method, 
WebSphere Studio Application Developer V5.1.1 will show the following warning 
for the 
ejbCreate
 method in the Tasks panel:
CHKJ2002W: This class should implement a matching ejbPostCreate method for 
this method (EJB 1.1: 9.2.4)
Remove FinderHelper interface
The FinderHelper interface was used in VisualAge for Java V3.5.3 to ease the 
generation of finder methods for entity beans. In order to generate code to find 
an object, or a list of objects from an SQL 
WHERE
 clause, it was sufficient to add a 
constant to the FinderHelper interface and a method to the home interface and 
generate the access bean and deployed code.
For example, to generate a finder method that returns a 
java.util.Enumeration
 
of the objects for which the 
VALUE
 column, assumed to be of type 
INTEGER
, has a 
value greater than the one supplied as a parameter to the finder, the following 
field would be added to the FinderHelper interface:
public static final String findGreaterThanWhereClause = “T1.VALUE > ?”;
And the following method would be added to the home interface: