Print Page | Close Window

Where is the DataAdapter's RowUpdated Event

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=575
Printed Date: 18-Apr-2025 at 2:35am


Topic: Where is the DataAdapter's RowUpdated Event
Posted By: johneevo
Subject: Where is the DataAdapter's RowUpdated Event
Date Posted: 03-Dec-2007 at 7:10am
Hi everybody,

We are evaluating the use of IdeaBlades against an Informix database. Our existing database heavily uses serial columns. As I understand it IdeaBlades does not come with support for serial columns. By "support for serial columns" I mean that there is no support for retrieving the newly generated serial value from the database and updating the appropiate entity with it.

So I thought I might be able to handle the DataAdapter's RowUpdated event to step in and retrieve the newly generated serial value from the database and update the entity myself. Unfortunately I can't found where IdeaBlades surfaces this event. Can anybody tell me how I can handled this event using IdeaBlades?

Thanks.



Replies:
Posted By: davidklitzke
Date Posted: 03-Dec-2007 at 10:32pm
We do handle the problem of retrieving a newly generated identity column from the database and then matching it up with the appropriate object in the cache as it completes its roundtrip.  If you want to, we are happy to allow you to use this mechanism
 
We also give you cimplete control of generating the keys for your new objects, so if you want you want to take complete control of this, you just need to hook into the IdGenerator interface.  For more details, see the Developer's Guide.
 
However, if you just want to hook up to an event that happens just before and after each save to the PersistenceManager, use the Saving and Saved Events.   Just before database save, the Saving event fires and you are free to modify the properties of each object before they go to the database.  The database then fixes up the keys as they are being saved.  After the the database save, the PersistenceManager roundtrips the data, and fires the Saved event, during which you can update the data.

 


Posted By: johneevo
Date Posted: 04-Dec-2007 at 4:47pm
Hi David,

Thanks for the reply.

Originally posted by davidklitzke

We do handle the problem of retrieving a newly generated identity column from the database and then matching it up with the appropriate object in the cache as it completes its roundtrip.  If you want to, we are happy to allow you to use this mechanism
 


Can you tell me how and were you do this and, more importantly, how I can use it. My understanding of how IdeaBlades works is that before updates are issued to the DB your framework calls the ConvertTempIdsToRealIds method. This method gets the next identity value(s) from the DB prior to submitting any inserts to the DB and updates the appropriate entities and their child entities. This approach does not work for the version of Informix that we are using. We need to perform the actual insert and then the DB generates the next identity value (or in Informix speak, the next serial value). Then before any other sql statements are executed, we need to get the newly generated serial value from the DB. Then of course we need the entity to be updated with this value and any children entities to have their linking columns updated before they are saved to the DB.

Hopefully I am just missing something here and you do have a mechanism built in to support this.




Print Page | Close Window