Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

V URGENT! Object updated in mapper but not in calling code!

Posted on 2004-04-29
5
Medium Priority
?
212 Views
Last Modified: 2010-04-24
I am having trouble with a bug that has popped up in our Object Mapper. If I pass in (to the mapper) an object to be destroyed, during the destruction process, the object is removed from any collections that form part of any bi-directional 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 objDeliveryCategory, which has a collection called allDeliveryBands, which contains 3 DeliveryBand objects. Each of these DeliveryBand objects also has an inverse relationship back to objDeliveryCategory, thus making a bi-directional 1..* relationship.  When I pass in one of the DeliveryBand objects to be destroyed: ObjectMapper.destroyObject(objDeliveryBand), the mapper removes objDeliveryBand from the allDeliveryBands collection that makes up part of the relationship and persists the changes to the collection. This all works fine and the correct rows are removed from the database. When I debug-step through the code in the mapper 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"

This is fine as the collection now has just 2 objects. 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. The database had been successfuly updated, the mapper seemed to be doing its job, but once out of the mapper, the object hasn't been removed. 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?

This is an URGENT problem as it is holding up a project with an impending deadline. I've assigned 500 points, but am happy to add more. Any help is greatly appreciated.

Regards.

Stephen.
0
Comment
Question by:sroughley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11123178
Did you find a solution to this yourself?

Bob
0
 

Author Comment

by:sroughley
ID: 11124996
Ah. I completely forgot about asking this question. Yes, it was solved. It turned out that the interface was caching the objects in the Session StateBag, which removed them from the control of the DAL's IDMap/Cache.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11125735
Could you clean up this question then?

Thanks,
Bob "Cleanup Volunteer"
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 11196594
PAQed, with points refunded (500)

Computer101
E-E Admin
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question