Hibernate Application: AdminApp - updated to use latest Webwork and Hibernate ================================================================================ version 0.9.2 (forked?), 30 December 2005 Purpose -------------------------------------------------------------------------------- Demo app based on the original Hibernate demo updated to use Webwork 2.2 and Hibernate 3.1. No new functionality has been added just the configuration is changed and some files modified accordingly. Main purpose is to test the use of the new Spring managed IoC in Webwork 2.2 (requires Springframework 2). Secondary purpose is to test the use of the following stack :- Sitemesh Freemarker Webwork Spring Hibernate Derby Tomcat Changes -------------------------------------------------------------------------------- 1. using all latest jar files (as of Dec 2005) hibernate 3.1 webwork 2.2 b4 springframework 2.0 m1 + their dependencies 2. web.xml changed to use latest webwork and spring filters/listeners. 3. removed components.xml; HibernateSession and HibernateSessionFactory now configured via Spring's applicationContext.xml. 4. ..Aware interfaces removed - Spring wiring don't require them. (This is prove of concept not argument for/against interfaces...) 5. added setDataSource, setMappingResources and setHibernateProperties methods and changed init() in HibernateSessionFactory to allow it to be fully configured via Spring. 6. HibernateInterceptor; invocation.getAction() now returns an Object (why?) so a cast to (Action) is required. 7. This is an odd one (can someone shed some light?) getSession.lock was used in AddRoleToUserAction and RemoveRoleFromUserAction this had to be changed to getSession.update to work properly. Originally, add or remove roles from user works only once after search, cannot add then remove straight away, or remove then remove another straight away. Complains that session is closed. Changing from lock to update fixes this. 8. Except for index.jsp all jsp's removed and replaced with freemarker ftl files. 9. Common page elements put into main.ftl sitemesh decorator. 10. xwork.xml changed to use freemarker as result for all actions and extra "dumb" actions added to replace direct calls to jsp's in the original. 11. Switched configuration to use embedded Derby database, but any Hibernate tested database should work. Getting Spring to work in the TestCase required a bit more time than available. An initForTest() method was added to HibernateSessionFactory which is the same as the original init(). This is used in TestCase together with hibernate.cfg.xml. Nice side effect of this is a new and seperate database can be created each time the test is run. Added junit.extensions.TestSetup to close database at the end of all tests. Junit run finishes with : Tests run: 5, Failures: 0, Errors: 1. Not sure where that Error is (can anyone help?) Webwork's Config Browser is available under http://localhost:8080/adminapp/config-browser/index.action