How to insert data to database using hibernet & struts

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ghjk
    Contributor
    • Jan 2008
    • 250

    How to insert data to database using hibernet & struts

    I want to insert web application data to mysql database. I'm using struts, jsp and hibernet.This is my action class.
    Code:
    public ActionForward execute(ActionMapping mapping, ActionForm form,
                HttpServletRequest request, HttpServletResponse response)
                throws Exception {
    
            MemberActionForm formbean = (MembeActionForm) form;
           
          
            data.Dvb user = new data.Dvb();
            viewer.setName(formbean.getMembername());
            
            viewer.setBirthDate(formbean.getBirthdate());
           
    
            Session s = data.DataAccess.getDataAccess().getSession();
            Transaction tr = s.beginTransaction();
            s.save(viewer);
            tr.commit();
            
            return mapping.findForward(SUCCESS);
        }
    }
    I got the error saying

    "org.hibernate. PropertyValueEx ception: 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..
Working...