You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Andrus Adamchik <an...@objectstyle.org> on 2007/11/27 15:28:08 UTC

Cayenne as AJAX backend

While I always thought of Cayenne zero-effort ability to store state  
in memory between requests as a great feature, in a normal web  
application I avoided using it when possible, cause you need to be  
extra careful about back button issues and such if you have some  
uncommitted session state.

Now I started to get involved in more frontend development, naturally  
using JavaScript and asynchronous communication with the server.  
That's where this feature shines. A user can spend significant time on  
a single page, loading and storing data from various UI elements via  
AJAX, using a session ObjectContext to maintain in-memory object  
graph. After (s)he is satisfied with results, the user clicks "Save"  
button once, the graph is saved to the database. This way there's no  
need to keep the entire graph on the client, client code can save  
changes incrementally in response to the user actions, avoiding  
sending large chunks of XML across the wire. Nice and clean...

Now I guess using a nested DataContext is still a good idea in this  
situation for the same reason as a regular web app - back button,  
reload, multiple windows, etc...

Andrus