Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

Stuts-hibernate integration.

Anoop

2008-10-13


Author LoginPost Reply
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@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 gg3721.com - Jax Systems, LLC, U.S.A.