We Recommend

Java How to Program Java How to Program
Takes a new tools-based approach to Web application development that uses Netbeans 5.5 and Java Studio Creator 2 to create and consume Web Services. Features new AJAX-enabled, Web applications built with JavaServer Faces (JSF), Java Studio Creator 2 and the Java Blueprints AJAX Components. Includes new topics throughout, such as JDBC 4, SwingWorker for multithreaded GUIs, GroupLayout, Java Desktop Integration Components (JDIC), and much more.


Posted By

narkisr on 03/17/08


Tagged

java spring Hibernate


Versions (?)


Spring and Hibernate simple configuration


Published in: Java 


URL: HibernateAndSpringConfiguration

This spring context configures a simple hibernate session (for annotated classes).


  1. <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
  2. lazy-init="true" parent="classesListContainer">
  3. <property name="dataSource">
  4. <ref bean="dataSource"/>
  5. </property>
  6. <property name="hibernateProperties">
  7. <props>
  8. <prop key="hibernate.dialect">org.hibernate.dialect.SybaseDialect</prop>
  9. <!--<prop key="hibernate.show_sql">true</prop>-->
  10. <!--<prop key="hibernate.format_sql">true</prop>-->
  11. <!--<prop key="hibernate.hbm2ddl.auto">validate</prop>-->
  12. </props>
  13. </property>
  14. <property name="annotatedClasses">
  15. <list>
  16. <value>com.dummy.DummyClass</value>
  17. <!-- list of all the annotated classes -->
  18. </list>
  19. </property>
  20. </bean>
  21.  
  22. <!-- A template which works with hbm -->
  23. <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate" lazy-init="true">
  24. <property name="sessionFactory" ref="sessionFactory"/>
  25. </bean>

Report this snippet 

You need to login to post a comment.