Posted By

narkisr on 03/17/08


Tagged

java spring Hibernate


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

liqweed
jcblitz
haru01
appx
chinyeh


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.