struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anoop <anoopdh2...@gmail.com>
Subject Stuts-hibernate integration.
Date Mon, 13 Oct 2008 05:47:28 GMT
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


Mime
View raw message