Struts2.2.1 and hibernate integration application
Posted on: March 4, 2011 at 12:00 AM
In this application, you will see how to integrate struts2.2.1 and hibernate.

Struts2.2.1 and hibernate integration application


hibernate.cfg.xml

Description

This is the hibernate configuration file used for providing database connection for the application. It also provide mapping tag which our model class to database table.

Code

<?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">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://192.168.10.13:3306/onlinexamination</property>
<property name="hibernate.connection.username">root</property>
<property name="connection.password">root</property>
<property name="connection.pool_size">1</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</property>
<property name="show_sql">true</property>
<property name="current_session_context_class">thread</property>
<property name="hbm2ddl.auto">update</property>
<mapping class="net.roseindia.Model.AddInformation"/>
</session-factory>
</hibernate-configuration>

Related Tags for Struts2.2.1 and hibernate integration application:

Advertisements

Ads

 
Advertisement null

Ads