How To Run Simple Program Using Spring and Hibernate

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 3

How to run simple program using spring and hibernate

Step 1:
Get project from
http://www.zabada.com/technology/Wiki.jsp?page=ZabadaSpringRecipesExampleCode

Step 2:
Copy lib and lib and lib-build from that project to the a separate folder say temp

Step 3:
oracle drivers ojdbc14.jar and ojdbc14_g.jar need to be added to the lib folder.

They would be available in the path of Orcale 10g

eg: C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib

copy the two files and paste it into the temp\lib folder

Step 4:
Create project folder say zabada-spring-recipes that should contains the following folder
and files:

1. conf
2. lib
3. lib-build
4. src
5. war
6. buile.xml (file)

where the lib and lib-build copied from temp folder

in src folder we have source folders like


1. base
2. hibernate
3. springmvc

in base dir we have extra a xml file called filename.hbm specifies mapping table and its
fields in database (mapping )

in hibernate dir we have a xml file called applicationContext-hibernate specifies the


database connection oriented details

in war dir we have folders like


1. css
2. images
3. WEB-INF
4. index.html

web-inf contains two folders and some xml files


1. jsp
2. classes
3. applicationContext-hibernate.xml
4. action-servlet.xml
5. springmvc-servlet.xml
6. web.xml

very important that a file views.properties should be in classes folder

build.xml file in root dir contains way to create war files

how to deploy and run:

go to command window
change dir as your project dir
type command as “ant war”
you will have a .war file in your build folder
simply copy it and paste in your tomcat webapps folder

run the project

You might also like