1600 PMP mock questions 1400 CAPM mock questions 800 SCJP 6 mock questions 600 OCAJP 7 mock questions 590 OCPJP 7 mock questions 556 SCWCD 5 mock questions 500 OCEJWCD 6 mock questions pdfDownload (java,struts, hibernet etc)

Struts Tutorials

Integration Struts Spring Hibernate

Step 1.
In the struts-config.xml add plugin
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation"

Step 2.

In the applicationContext.xml file
Configure datasourse
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName"><value>oracle.jdbc.driver.OracleDriver</value>
<property name="url"><value>jdbc:oracle:thin:@</value>
<property name="username"><value>sa</value></property>
     <property name="password"><value></value></property>

Step 3.

Configure SessionFactory
<!-- Hibernate SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean">
<property name="dataSource"><ref local="dataSource"/></property>
<property name="mappingResources">
<property name="hibernateProperties">
<prop key="hibernate.dialect">net.sf.hibernate.dialect.OracleDialect </prop>

Step 4.
Configure User.hbm.xml
<class name="org.test.model.User" table="app_user">

<id name="id" column="id" >
<generator class="increment"/>
<property name="firstName" column="first_name" not-null="true"/>
<property name="lastName" column="last_name" not-null="true"/>


Step 5.

In the applicationContext.xml ? configure for DAO
<bean id="userDAO" class="org.test.dao.hibernate.UserDAOHibernate">
<property name="sessionFactory"><ref local="sessionFactory"/></property>

Step 6.

DAO Class
public class UserDAOHibernate extends HibernateDaoSupport implements UserDAO {
private static Log log = LogFactory.getLog(UserDAOHibernate.class);

public List getUsers() {
return getHibernateTemplate().find("from User");

public User getUser(Long id) {
return (User) getHibernateTemplate().get(User.class, id);

public void saveUser(User user) {

if (log.isDebugEnabled()) {
log.debug("userId set to: " + user.getId());

public void removeUser(Long id) {
Object user = getHibernateTemplate().load(User.class, id);

Reviews and Comments

PMP, CAPM, PMI is a registered certification mark of the Project Management Institute, Inc

Copyright © www.techfaq360.com 2019

About US | Contact US | Privacy Policy | Terms and Conditions  | Website disclaimer  | Cancellation and Refund Policy  | Shipping & Delivery Policy