Aug 11th, 2008, 07:33 AM
Annotation based controller and concurrent request (synchronization)
as I am changing my application from XML to annotation style (component scanning) I need further knowlege about how to get a AT-Controller (thread-) save.
I've got one controller implementing the AT-Controller annotation. This controller is able to list, create, delete and edit the object. So I added a few methods: list, delete, create(GET), view(GET) and save(POST).
-create and view must work on the same JSP template, but differ in the formBackingObject they use (create/empty & view/fromDatabase).
-Update checks for an id and calls a DAO.new or DAO.update method.
Furthermore I use AT-SessionAttributes to keep the attributes I do not want to pass to the JSP, but are important fields to update (e.g. id).
so far everything works fine for me, but I cannot distinguish different edit requests.
If I call object 3 and object 27 concurrently (tabbed browsing) only 27 is alive in my session and all changes I submit to 3 and 27 go to only 27.
I think there must be an easy way to synchronize different requests from one user without having this trouble, but I do not know how to configure this.
I wrote about synchronizeOnSession in HttpSession or stuff like this but do not know how to configure this in an annotation based Spring 2.5 environment with Hibernate 3 ...
PS: Please let me know if you need any code examples...
PPS: "You are only allowed to post URLs to other sites after you have made 15 posts or more." ... occurs whenever I use annotations (AT) ...
Tags for this Thread