aswininayak
aswininayak

Reputation: 973

Hibernate Setup in eclipse helios

How I can setup Hibernate for a Dynamic Web application by using Eclipse Helios? I am a newbe so please let me know if there is any example.

I tried for Java application and included all JARS and it worked fine. But don't understand how I can do it for Web application and test it.

I will use Struts2 so I will appreciate if I can get appropriate example or guidance.

Upvotes: 0

Views: 753

Answers (3)

batbaatar
batbaatar

Reputation: 5468

First, download Struts2, and import example WAR file into Eclipse. You can find it from the source folder: struts-2.3.1-all\struts-2.3.1\apps\struts2-blank.war

Second, you should install Eclipse Hibernate Plugin. Goto Window > Preferences > Install/Update > Available Software Sites and add following link and name it JBossTools or something.

http://download.jboss.org/jbosstools/updates/helios/

Depending on your needs you can install Hibernate Plugins for many project types. In this case, select web application plugin.

And after, you should include Hibernate Core libraries into your classpath. I would recomment Hibernate 3.6 and greater. Because it does not depend on asm (asm-3.3.jar, asm-commons-3.3.jar ...) anymore. If you use earlier versions you might encounter some problems, since Struts2 also depend on asm libraries.

Then create your database, and use following link to configure and generate model bean classes.

http://casteyo.wordpress.com/2007/06/06/conf_hibernate/

Now you don't need to write mapping files by yourselves. And with DAO factory pattern you have your way to finish your project.

Hope this helps, and Goodluck

Upvotes: 0

JB Nizet
JB Nizet

Reputation: 692231

Drop the jars in WEB-INF/lib. Those jars are automatically added by Eclipse to the project build path, and constitute (with the WEB-INF/classes directory and the container classpath) the classpath of the webapp.

Upvotes: 1

Related Questions