A fix is available
APAR status
Closed as program error.
Error description
Product name: Rational Application Developer 7.5.3 Description of problem: EJB finder returns no results due to primary key not set in Inde xedRecord within BeanInjectorImpl Step to reproduce: 1. Create a new EJB project 2. Create new BMP bean - Corridor with primary key id and fields int locationNr, int storageNr - Station with primary key id and fields boolean isActive - IntermediateStation with primary key id and fields int order , int pathType 3. Select bean IntermediateStation, within section relationships - Station-IntermediateStation, Station with multiplicity 0..1 and IntermediateStation with 0..* - Corridor-IntermediateStation, Corridor named source with mul tiplicity 0..1 and IntermediateStation 0..* - Corridor-IntermediateStation, Corridor named target with mul tiplicity 0..1 and IntermediateStation 0..* 4. Select bean IntermediateStation and create an EJBQL Query wit h name findTest with parameters - ejbs.CorridorLocal source, - int targetLocationNr - int targetStorageNr - int pathType - int invOrder with return type java.util.Collection. Click Next. Specify the following query: select distinct object(zs) from IntermediateStation zs where (zs .source = ?1) and (zs.target.locationNr = ?2) and (zs.target.sto rageNr = ?3) and (zs.pathType = ?4) and (zs.station.isActive = t rue) and (zs.order = (select (max(zs2.order) - ?5 + 1) as positi on from IntermediateStation zs2 where zs2.source = ?1 and zs2.t arget.locationNr = ?2 and zs2.target.storageNr = ?3 and zs2.path Type = ?4)) 5. Create a backend for the EJB 6. Run Prepare for deployment Result: The file IntermediateStationBeanInjectorImpl_xxxx.java contains: public void ejbFindByTest(ejbs.CorridorLocal source, int targetL ocationNr, int targetStorageNr, int wegTyp, int invOrder, javax.resource.cci.IndexedRecord record) { record.set(0,((java.lang.Integer)source.getPrimaryKey())); record.set(1,new Integer(targetLocationNr)); record.set(6,new Integer(targetLocationNr)); record.set(2,new Integer(targetStorageNr)); record.set(7,new Integer(targetStorageNr)); record.set(3,new Integer(pathType)); record.set(8,new Integer(pathType)); record.set(4,new Integer(invOrder)); } Expected: The file IntermediateStationBeanInjectorImpl_xxxx.java contains: public void ejbFindByTest(ejbs.CorridorLocal source, int targetL ocationNr, int targetStorageNr, int wegTyp, int invOrder, javax.resource.cci.IndexedRecord record) { record.set(0,((java.lang.Integer)source.getPrimaryKey())); record.set(5,((java.lang.Integer)source.getPrimaryKey())); record.set(1,new Integer(targetLocationNr)); record.set(6,new Integer(targetLocationNr)); record.set(2,new Integer(targetStorageNr)); record.set(7,new Integer(targetStorageNr)); record.set(3,new Integer(pathType)); record.set(8,new Integer(pathType)); record.set(4,new Integer(invOrder)); }
Local fix
Problem summary
If an EJB-QL statement is created with a subselect statement and both query statements makes use of the primary key column of the first bean then the value of the primary key of this bean will only be populated for the first occurrence of the attribute. For example, if you had a query like: select object(o) from Bean b1 where(o.pk = ?1) and (o.field1 = (select object(p) from Bean b2 where (o.pk = ?1))) The resulting body for this finder method in the InjectorImpl EJB deployment class would only contain the primary key value for the first instance in the query: record.set(0,((java.lang.Integer)bean.getPrimaryKey())); rather than both instances: record.set(0,((java.lang.Integer)bean.getPrimaryKey())); record.set(1,((java.lang.Integer)bean.getPrimaryKey())); As a consequence no results will be returned from the finder.
Problem conclusion
The primary key will always be added to the record index no matter how many times it is utilized in an EJB-QL statement. The fix for this APAR is currently targeted for inclusion in Rational Application Developer fixpack V7.5.5.1. Refer to the follow recommended fixes page for information about this fixpack: http://www.ibm.com/support/docview.wss?uid=swg27007823
Temporary fix
Comments
APAR Information
APAR number
PK98205
Reported component name
RATL APP DEV WI
Reported component ID
5724J1901
Reported release
752
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2009-10-08
Closed date
2010-04-01
Last modified date
2010-04-01
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
RATL APP DEV WI
Fixed component ID
5724J1901
Applicable component levels
R752 PSN
UP
[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSRTLW","label":"Rational Application Developer for WebSphere Software"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7.5.2","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]
Document Information
Modified date:
01 April 2010