Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object being updated in one place but not another...

Status
Not open for further replies.

steverbs

Programmer
Jul 17, 2003
253
GB
I am having a little trouble with a bug that has popped up in my Object Mapper. If I pass in an object to be destroyed, during this process, the object is removed from any collections that form part of any * object relationship that the object is involved in. In the mapper this works fine, but the changes to the collection are not reflected outside of the mapper. Take the following scenario:

I have an object called objDeliveryCategories, which has a collection called allDeliveryBands, which contains 3 DeliveryBand objects. When I pass in one of the DeliveryBand objects to be destroyed: ObjectMapper.destroyObject(objDeliveryBand), the mapper removes objDeliveryBand from the allDeliveryBands collection and persists the collection. This all works fine and the correct rows are removed from the database. When I debug-step through the mapper's code and use the command window to check the collection after the object has been removed and the collection persisted, I get the following:

?objPInverse.count
2 {Integer}
[Integer]: 2 {Integer}
?objPInverse.oid.ToString() 'Check the oid of the object to ensure it is the same collection
"e94c68fa-e0e9-4816-88af-05190dd74e00"

However, once the ObjectMapper.destroyObject(objDeliveryBand) bit is completed, if I continue to step through the code of the subroutine that called the destroyObject function and check the collection that should now be minus one object, I get the following:

?Me.myDeliveryCategory.allDeliveryBands.Count()
3
?Me.myDeliveryCategory.allDeliveryBands.oid.ToString()
"e94c68fa-e0e9-4816-88af-05190dd74e00" 'The oid of the object is the same, so this is the same collection

And the object is still there. What is going on? The only thing that I can think of is that the offending collection is somehow being copied within the mapper. Could it be something else? And if not, how could this kind of behaviour happen? Is there anyway that I can check to see if the collection is being copied?

Any help is greatly appreciated.

Regards.

Stephen.
 
How are you removing the record, are you using a stored procedure, delete method defined by the dataAdapter. What??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top