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

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


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..


b) This throws an exception:

EmployeeBean employee = employeeHome.find..

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

The exception is:


at java.util.Hashtable.get(



at com.giasa.giares.ejb.RegistroBean0PM.setDepId(


I use NW04sSR1 and Oracle 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.