/ Published in: Java
This spring context configures a simple hibernate session (for annotated classes).
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean" lazy-init="true" parent="classesListContainer"> <property name="dataSource"> <ref bean="dataSource"/> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.SybaseDialect</prop> <!--<prop key="hibernate.show_sql">true</prop>--> <!--<prop key="hibernate.format_sql">true</prop>--> <!--<prop key="hibernate.hbm2ddl.auto">validate</prop>--> </props> </property> <property name="annotatedClasses"> <list> <value>com.dummy.DummyClass</value> <!-- list of all the annotated classes --> </list> </property> </bean> <!-- A template which works with hbm --> <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate" lazy-init="true"> <property name="sessionFactory" ref="sessionFactory"/> </bean>
URL: HibernateAndSpringConfiguration