Bulletproof web design - 300 APPENDIX C n HIBERNATE AND SPRING APPENDIX
300 APPENDIX C n HIBERNATE AND SPRING APPENDIX C n HIBERNATE AND SPRING The Java Standard Template Library JARs The HSQLDB driver JAR The Spring JAR This requires the list of JAR files shown in Listing C-1 to be included in the WEB-INF/lib directory of our example application. Listing C-1. The Required JAR Files antlr-2.7.6rc1.jar asm-attrs.jar asm.jar cglib-2.1.3.jar commons-collections-2.1.1.jar commons-logging-1.0.4.jar dom4j-1.6.1.jar ehcache-1.1.jar ejb3-persistence.jar hibernate-annotations.jar hibernate3.jar hsqldb.jar jdbc2_0-stdext.jar jstl.jar jta.jar spring.jar standard.jar xml-apis.jar Configuring Hibernate from a Spring Application A conventional Hibernate application needs access to its database and the entity mapping information. The point of access to a fully configured Hibernate environment is the session factory, from which Sessionobjects are obtained. Spring provides a bean to represent the session factory, but provides a few additional options in order to configure its resources. In our example application, we take the line of least resistance and use a Hibernate configuration file (hibernate.cfg.xml) to represent both the mapping information and the database configuration. For easy reference when setting up a Spring application, we show a sample Hibernate configuration file in Listing C-2. Listing C-2. Familiar Territory: A Standard Hibernate Configuration File Used in Spring
We highly recommend you visit web and email hosting services if you need stable and cheap web hosting platform for your web applications.