APPENDIX C n HIBERNATE AND (Web hosting account) SPRING 303 n

APPENDIX C n HIBERNATE AND SPRING 303 n HIBERNATE AND SPRING 303 Listing C-6. Configuring Hibernate Purely from Spring
com/hibernatebook/spring/Paper.hbm.xml com/hibernatebook/spring/Article.hbm.xml 0 true org.hibernate.dialect.HSQLDialect
Note that in Listing C-6, purely in order to demonstrate the use of mapping files in a LocalSessionFactoryBean configuration, we omit the specification of a Hibernate AnnotationConfiguration for the configurationClass property, causing it to default to the normal (mapping file based) Hibernate Configuration object. Typically, the mappings themselves are specified in the conventional Hibernate manner through XML mapping files or Java annotations. It would be entirely possible to arrange to configure these externally, but no default Spring classes are provided to achieve this, and it is difficult to see any obvious benefit that would accrue from such an approach. Using Hibernate in Your Spring Beans With your session factory configured as a Spring bean, you can now go on to create DAOs that take advantage of Hibernate s functionality. Here, Spring really starts to come into its own, as it provides you with the invaluable HibernateDaoSupport class to form the basis of your DAOs (see Listing C-7). Listing C-7. Declaring the Interface for Our DAO package com.hibernatebook.spring.dao; import java.util.List; import com.hibernatebook.spring.Article; import com.hibernatebook.spring.Paper;
We recommend high quality webhost to host and run your jsp application: christian web host services.

Leave a Reply