Spring 3 with hibernate Configuration
Now, we will see the integration between spring and hibernate. This is very easy to learn. You just go through the following hibernate configuration steps:
hibernate.cfg.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate
Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/
hibernate-configuration-3.0.dtd">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory>
<!-- For MySql -->
<property name="connection.username">root</property>
<property name="connection.password"></property>
<property name="connection.url">jdbc:mysql://
localhost:3306/spring3</property>
<property name="dialect">org.hibernate.dialect.
MySQLInnoDBDialect</property>
<property name="myeclipse.connection.profile">mysql
</property>
<property name="hibernate.query.substitutions">true 1,
false 0</property>
<property name="connection.driver_class">com.mysql.jdbc.
Driver</property>
<!-- <property name="hbm2ddl.auto">create</property> -->
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">
org.hibernate.cache.NoCacheProvider
</property>
<!-- Echo all executed SQL to stdout -->
<!-- <property name="show_sql">true</property>-->
<!-- Income -->
<mapping class="developerhelpway.com.model.Student" />
</session-factory>
</hibernate-configuration> |
Download Spring 3 CRUD Application