Skip to Content
0
Former Member
Jan 23, 2007 at 10:16 AM

Can't remove related Entity EJB when the foreign key is a CMP field

23 Views

I've a relationship between bean EmployeeBean and DeparmentBean (n:1), with a CMR field defined in Employee called 'deparment'.

I've a CMP field in EmployeeBean which is the foreign key itself, called 'depId'.

(It's easier to work putting the id in this field, than finding the correct instance of DepartmentBean to set a relation).

I can't remove the relation from the employee. I've never had this problem with other application servers. I still thinks there are some things wrong with the EJB implementation of SAP WAS.

a) This makes nothing, cos depId keeps its value:

EmployeeBean employee = employeeHome.find..

employee.setDepartment(null);

b) This throws an exception:

EmployeeBean employee = employeeHome.find..

employee.setDepId(null); // The same occurs if I setDeparment(null) too

The exception is:

java.lang.NullPointerException

at java.util.Hashtable.get(Hashtable.java:333)

at com.sap.engine.services.ejb.entity.pm.TransactionalPersistentCache.get(TransactionalPersistentCache.java:38)

at com.sap.engine.services.ejb.entity.pm.PersistentCache.supply(PersistentCache.java:81)

at com.giasa.giares.ejb.RegistroBean0PM.setDepId(EmployeeBean0PM.java:325)

...

I use NW04sSR1 and Oracle 9.2.0.7 with driver at native level.

It seems there is an intermediate cache messing the remove. How can I disable or flush this cache? Or simply, how can I remove the relation?

Thanks in advance.