|
|
|
To give you a more precise idea of what exactly will have to change:
bnoll@baitshop:~/projects/oss/appfuse-2/service$ find ./src/main/ -name \*.java | grep -v svn | xargs grep --color "\.save" ./src/main/java/org/appfuse/service/impl/UniversalManagerImpl.java: dao.save(o); ./src/main/java/org/appfuse/service/impl/GenericManagerImpl.java: genericDao.save(object); ./src/main/java/org/appfuse/service/impl/UserManagerImpl.java: dao.saveUser(user); ./src/main/java/org/appfuse/service/impl/RoleManagerImpl.java: dao.save(role); bnoll@baitshop:~/projects/oss/appfuse-2/web$ find . -name \*.java | grep -v svn | grep -v target | xargs grep --color "\.save" ./spring/src/main/java/org/appfuse/webapp/controller/UserFormController.java: getUserManager().saveUser(user); ./spring/src/main/java/org/appfuse/webapp/controller/UserFormController.java: saveMessage(request, getText("user.saved", user.getFullName(), locale)); ./spring/src/main/java/org/appfuse/webapp/controller/SignupController.java: this.getUserManager().saveUser(user); ./jsf/src/test/java/org/appfuse/webapp/action/UserFormTest.java: assertEquals(bean.save(), "mainMenu"); ./jsf/src/test/java/org/appfuse/webapp/action/SignupFormTest.java: assertEquals(bean.save(), "mainMenu"); ./jsf/src/main/java/org/appfuse/webapp/action/UserForm.java: userManager.saveUser(user); ./jsf/src/main/java/org/appfuse/webapp/action/UserForm.java: addMessage("user.saved"); ./jsf/src/main/java/org/appfuse/webapp/action/SignupForm.java: userManager.saveUser(user); ./struts/src/test/java/org/appfuse/webapp/action/SignupActionTest.java: assertEquals(action.save(), "success"); ./struts/src/test/java/org/appfuse/webapp/action/UserActionTest.java: assertEquals(action.save(), "input"); ./struts/src/test/java/org/appfuse/webapp/action/UserActionTest.java: assertEquals("input", action.save()); ./struts/src/main/java/org/appfuse/webapp/action/SignupAction.java: userManager.saveUser(user); ./struts/src/main/java/org/appfuse/webapp/action/BaseAction.java: this.save = save; ./struts/src/main/java/org/appfuse/webapp/action/UserAction.java: userManager.saveUser(user); ./struts/src/main/java/org/appfuse/webapp/action/UserAction.java: saveMessage(getText("user.saved")); ./tapestry/src/test/java/org/appfuse/webapp/pages/UserFormTest.java: ILink link = page.save(new MockRequestCycle()); ./tapestry/src/test/java/org/appfuse/webapp/pages/SignupFormTest.java: page.save(new MockRequestCycle()); ./tapestry/src/main/java/org/appfuse/webapp/pages/UserForm.java: userManager.saveUser(user); ./tapestry/src/main/java/org/appfuse/webapp/pages/UserForm.java: nextPage.setMessage(getText("user.saved", user.getFullName())); ./tapestry/src/main/java/org/appfuse/webapp/pages/SignupForm.java: getUserManager().saveUser(user); The second find from above isn't quite right and makes it look worse than it really is. Only manager.save*** calls will be affected so lines with things like "user.saved" and "bean.save()" can be ignored.
Attaching the patch for the service module. Still need to create the patch for the web module.
While you're in there digging around, can you check and see if it's possible to *not* return an object from the save() method? I know it's used in tests, but I don't know if it's used in the web tier. If it's not used in the web tier, you should just be able to call the method w/o re-assigning the returned variable. If we're never using the returned value or primary key in our application logic, it makes sense to not return it. iBATIS currently requires custom SQL for each database type to get the inserted id, and things would be a lot more portable if we didn't have to worry about that.
Here's the patch for the web tier. After the m4 release, I can apply these and commit the changes if everyone thinks that's the best way to go.
In response to Matt's comment, I see what you're saying regarding the pain it creates with iBatis... but it seems important to me to have the ability to have a live reference to the object you just saved. I'd rather a person have access to it and not use it, then not have access at all. If we don't give access to it at all, I'll bet we have someone ask for it sooner or later. Committed revision 2603.
Still need to get the implications of this fix in the release notes here: http://appfuse.org/display/APF/Release+Notes+2.0+M5 |
|||||||||||||||||||||||||||||||||||||||||||||||
This happens because the paradigm changes from this:
dao.save(o); //where o is guaranteed to get the new persistent state copied onto it
...to this:
o = dao.save(o); //the 'o = ' part is now required to ensure that o has the correct state
The plan is to wait until 2.0 final to do this though.