Chris - I just happened to be learning Hibernate and have created an example
application that uses Struts 2, Spring, and Hibernate together.

You can download the example application here:

http://www.brucephillips.name/struts/Struts2_Spring_Hibernate_Example.zip

After you unzip the archive, you'll find a README.txt in the project's root
folder that will
explain how to run the project.

The application was created using Eclipse 3.5 with the Maven 2 plugin.
The JDK used was JVM 1.6 on the Mac.

You can import this project into Eclipse by using Eclipse's
File - Import feature.

You can also run the application using Maven.
Navigate in a terminal (command) window to the project's root
folder (the folder where pom.xml resides).

Issue these commands:

mvn clean
mvn test (All 7 tests should pass successfully).
mvn jetty:run

When you see [INFO] Started Jetty Server open a web browser and navigate to
http://localhost:8080/index.html.

To stop the Jetty web server type CTRL-C in the terminal window.

In my example application I have my DAO classes extend Spring's
HibernateDaoSupport and I 
also use Spring's @Transactional annotation in the DAO classes.  Both the
Spring references
below explain this technique (Spring Recipes especially provides helpful
examples).

References:

Hibernate Made Easy, Cameron McKenzie, 2008
Spring Recipes, Gary Mak, 2008
Pro Spring 2.5, Jan Machacek and others, 2008

Bruce Phillips


I have done a fair amount of reading today on the topic again and
developed a few simple classes to support my service, model, and dao
architecture for using Hibernate 3.3.2 and Spring 2 with Struts2.  The
problem I am currently facing is I get a detached error when deleting
an object and I get a null pointer exception in SessionImpl.java when
I try to locate an object by its id.

-- 
View this message in context: 
http://old.nabble.com/Hibernate-Spring-tp26346725p26353559.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to