Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UnitOfWork - Toplink error 6004
Message
From
03/10/2005 20:07:06
 
 
To
All
General information
Forum:
Java
Category:
Other
Title:
UnitOfWork - Toplink error 6004
Miscellaneous
Thread ID:
01055701
Message ID:
01055701
Views:
272
I hope I can explain this clearly.

We have a Policy which contains Locations and Coverages. One of the Locations is marked as the HQ Location. If the State associated with the HQ Location changes, one of the values in one of the Coverages needs to change as well.

I can get to the point of changing the value in the class, but Toplink gets very angry at me when it tries to Commit the UnitOfWork. It gets so upset that it generates an exception
EXCEPTION [TOPLINK-6004](TopLink - 9.0.3.3 (Build 430)): oracle.toplink.exceptions.QueryException 
EXCEPTION DESCRIPTION:  The object[[com.ffab.farm.model.property.zDisruptionPercentCoverage],
with identity hashcode (etc)], 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. 
(For help read manual, see FAQ, etc)
It's bad enough having Toplink mad at me, but now my manager is mad as well. I've tried reading the manual but I was unable to find an example code that seemed at all relevant. I've got no real exposure to Toplink (and enough Java merely to be dangerous).

In the class definition I have a line
	private DisruptionofFarmingOpsIf disruptFarmOps = null;
In the body of the code I have
//  If the location changed causing the Disruption of Farming Operations
//  Percent of Coverage options to change, revert Percent Coverage to lowest legal value
//  (Rich Pupko 9/30/2005)
disruptFarmOps =(DisruptionofFarmingOpsIf) getTransaction().getPropertyCoveragePart().
      getOptionalPropertyCoverage("Disruption of Farming Ops");
if (disruptFarmOps != null){
  if (disruptFarmOps.hasDisruptExceptions()== false){
    if (disruptFarmOps.getZDisruptionPercentCoverage()
                      .getPercentofCoverage().compareTo("60%") <= 0){ 
      disruptFarmOps.setZDisruptionPercentCoverage
        (FarmApp.singleton()
                .getReferenceData()
                .getZDisruptionPercentCoverage("70%")
        );
    }
  }
}
The snippet above was lifted from a different class, where it actually does work. I still don't know how it gets registered in the UnitOfWork.

If somebody could show some sample code on how to register the class in the UnitOfWork, I would be eternally grateful.

.......Rich
Reply
Map
View

Click here to load this message in the networking platform