You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Anoop <an...@gmail.com> on 2008/10/13 07:47:28 UTC

Stuts-hibernate integration.

Hi,

I am working on a project of developing a web application and we have
decided to use struts and hibernate together. The problem is in their
integration and getting them to work together. I used the
struts-hibernate plugin code given at the hibernate site
http://www.hibernate.org/105.html. I also made the neccessary
modifications to the struts-config.xml file as instructed. However, I
get a null pointer exception when i try to open a session in the
struts action. Please help on how to integrate the two.

here are the relevant bits of code
in struts-config
<plug-in
		className="de.laliluna.hibernate.plugin.HibernatePlugIn">
			<set-property
				property="configFilePath"
				value="/hibernate.cfg.xml" />
			<set-property
				property="storeInServletContext"
				value="true" />
		</plug-in>


in struts action
SessionFactory _factory = (SessionFactory)
			   context.getAttribute(HibernatePlugIn.SESSION_FACTORY_KEY);*/
			
			Session ses = _factory.openSession(); <---this line throws exception..

-- 
Anoop Dhanvijay
DA-IICT

"Most of man's failures were when they didn't realize how close they
were to success, when they finally gave up!"

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