I thought I understood what was going on with Cayenne but alas it seems to be a misconception on my part!
I have a web application I am building. The database code had methods to insert, update, and delete objects which I am trying to switch over to use Cayenne from standard jdbc calls.... The inserts are working great. My database code had a call obtain a jdbc connection from a pool. I replaced this code with a DataContext.createDataContext(); which I believe is causing me problems on updates... The update method is called by the web application action beans and takes an object to update. This database method obtains a data context by calling DataContext.createDataContext() and trys to commit. This is not working. I added the org.apache.cayenne.conf.WebApplicationContextFilter to my web.xml but am not sure how to use these contexts correctly. The call to DataContext.getThreadObjectContext(); says it is deprecated and if my routine is being passed an object to write to the database how do I obtain or write it without the context? I tried using the call to object.getDataContext() on the passed in object but am being told this is also deprecated... My web page reads an object, displays it for the user to edit, and wants to write back the changes. It seems as though the context is tied to the object which I am okay with, but once the page is displayed to the user my request scope disappears and I need to rebuild the object based on the data entered and update the database.... How do I do this in the cayenne model? My other concern is am I creating a bunch of floating DataContexts with this method? Any help would be appreciated. Tony
