EXCEPTION [TOPLINK-6004]
402671Jan 31 2005 — edited Oct 2 2006Hello,
* We have a situation where there is a 1-1 relationship between the following entities..
* Award -> Application -> Solicitation -> SponsoringEntity -> Organization.
* We use TopLink with Oracle ,persistence using Java objects and use Indirection.
* We find the following error when doing the following :
// Get the existing AwardDAO object...
Award awardDAO = (Award) Utils.getDAOObject(orgId, Award.class);
// Create a new Summary Object...
AwardSummary awardSummaryDAO = ....;
// Set the Organization object from the existing Award Object...
awardSummaryDAO.setOrganization(awardDAO.getApplication().getSolicitation().getSponsoringEntity().getOrganization());
//----Get the following error.. ----
LOCAL EXCEPTION STACK:
EXCEPTION [TOPLINK-6004] (TopLink - 9.0.3.5 (Build 436)): oracle.toplink.exceptions.QueryException
EXCEPTION DESCRIPTION: The object [gov.usdoj.ojp.gms.common.domain.dao.toplink.OrganizationImpl@17cb5b], of class [class gov.usdoj.ojp.gms.common.domain.dao.toplink.OrganizationImpl], with identity hashcode (System.identityHashCode()) [1,559,387],
is not from this UnitOfWork object space, but the parent session's. The object was never registered in this UnitOfWork,
but read from the parent session and related to an object registered in the UnitOfWork. Ensure that you are correctly
registering your objects. If you are still having problems, you can use the UnitOfWork.validateObjectSpace() method to
help debug where the error occurred. For more information, see the manual or FAQ.
QUERY: WriteObjectQuery(gov.usdoj.ojp.gms.common.domain.dao.toplink.OrganizationImpl@17cb5b)
at oracle.toplink.exceptions.QueryException.backupCloneIsOriginalFromParent(Unknown Source)
================================================
But if I get the Organization Id and fetch a new DAO object and set on the AwardSummary class, i do not get the error..
Pseudo-code...
long orgId = awardDAO.getApplication().getSolicitation().getSponsoringEntity().getOrganization().getId().longValue();
Organization orgDAO = (Organization) Utils.getDAOObject(orgId, Organization.class);
awardSummaryDAO.setOrganization(orgDAO);
Can I get any help or thoughts on this behaviour.. ?
Thanks
Vidya R.