By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,285 Members | 2,124 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,285 IT Pros & Developers. It's quick & easy.

How to insert data to database using hibernet & struts

100+
P: 250
I want to insert web application data to mysql database. I'm using struts, jsp and hibernet.This is my action class.
Expand|Select|Wrap|Line Numbers
  1. public ActionForward execute(ActionMapping mapping, ActionForm form,
  2.             HttpServletRequest request, HttpServletResponse response)
  3.             throws Exception {
  4.  
  5.         MemberActionForm formbean = (MembeActionForm) form;
  6.  
  7.  
  8.         data.Dvb user = new data.Dvb();
  9.         viewer.setName(formbean.getMembername());
  10.  
  11.         viewer.setBirthDate(formbean.getBirthdate());
  12.  
  13.  
  14.         Session s = data.DataAccess.getDataAccess().getSession();
  15.         Transaction tr = s.beginTransaction();
  16.         s.save(viewer);
  17.         tr.commit();
  18.  
  19.         return mapping.findForward(SUCCESS);
  20.     }
  21. }
  22.  
  23.  
I got the error saying

"org.hibernate.PropertyValueException: not-null property references a null or transient value"

I'm new to struts and hibernet. so still couldn't understand the error.Please help me..
May 10 '10 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.