We have a table say A for which two columns constitute primary key col-a and say col-b. A has one to many relationship to another table X. Both the above said colulmns are there in table X and have foreign key constraint to table A. We are getting exceptions when we try to set the collection of entity X to entity A, since the foreign keys are not automatically updated. Basic quetion is does CMR works for composite foreign keys??
When we try to call addAll() on the collection , the container throws a null pointer exception. On a side note for a composite primary key, can u tell me what is a good hashcode implementation? coz I think that also may be the problem
Here is the error that we are getting when adding an enity threshold to another entity Adjustments Adjustment table has two columns as the primary key(the class AdjustmentPK) and hence these are also foreign keys in threshold. It throws an exception whenever we are trying to add a threshold refernce to adjustment.. Most of the code is generated by the ejbgen tool
java.lang.NullPointerException at com.circuitcity.vma.ejb.pa.local.AdjustmentsPK.hashCode(AdjustmentsPK .java:26) at com.circuitcity.vma.ejb.pa.local.AdjustmentsPK.equals(AdjustmentsPK.j ava:43) at com.circuitcity.vma.ejb.pa.local.PAAdjustmentsEntityBean_5r9txz__WebL ogic_CMP_RDBMS_threshHolds_Set.add(PAAdjustmentsEntityBean_5r9txz__WebLogic_CMP_ RDBMS_threshHolds_Set.java:282) at com.circuitcity.vma.ejb.pa.helper.PAAdjustmentEntityHelper.updateThre shHold(PAAdjustmentEntityHelper.java:115) at com.circuitcity.vma.ejb.pa.helper.PAAdjustmentEntityHelper.create(PAA djustmentEntityHelper.java:86) at com.circuitcity.vma.ejb.pa.helper.PAAdjustmentEntityHelper.create(PAA djustmentEntityHelper.java:57) at com.circuitcity.vma.ejb.pa.helper.PAEntityHelper.updateAdjustments(PA EntityHelper.java:121) at com.circuitcity.vma.ejb.pa.local.PASessionFacade.updateAdjustments(PA SessionFacade.java:97) at com.circuitcity.vma.ejb.pa.local.PASessionFacade_8sw7cg_EOImpl.update Adjustments(PASessionFacade_8sw7cg_EOImpl.java:154) at com.circuitcity.vma.ejb.pa.local.PASessionFacade_8sw7cg_EOImpl_WLSkel .invoke(Unknown Source) at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362) at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerR ef.java:114) at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313) at weblogic.security.service.SecurityServiceManager.runAs(SecurityServic eManager.java:785) at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.jav a:308) at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest .java:30) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134) error...null
well, we found the error .. the ejbgen tool has generated the primary key class in which the hashcode method used to give null pointer exception since the objct on which the method is called is null before the container sets the relationship fields!!
If we don't do the shopping, we won't have anything for dinner. And I've invited this tiny ad:
Gift giving made easy with the permaculture playing cards