title: Error:java.lang.IllegalArgumentException: attempt to create saveOrUpdate event with null entity
body: <p>I am trying to insert into database. I am posting my code below. </p>
  
  <p>DAO class:</p>
  
  <pre><code>package com.persistent.progracers.data.dao;    
  
  import org.hibernate.Session;
  import com.persistent.progracers.data.pojo.UserDemographicInfo;
  
  public class UserDemographicInfoDAO {
  public void persist(UserDemographicInfo userDemographicInfo, Session session){
      session.save("UserDemographicInfo", userDemographicInfo);
  }
  
  public void update(UserDemographicInfo userDemographicInfo, Session session){
      session.saveOrUpdate("UserDemographicInfo", userDemographicInfo);
  }
  
  public void delete(UserDemographicInfo userDemographicInfo, Session session){
      session.delete("UserDemographicInfo", userDemographicInfo);
  }
  
  }  
  </code></pre>
  
  <p>POJO class: </p>
  
  <pre><code> package com.persistent.progracers.data.pojo;
  
   import java.util.Date;
  
   @SuppressWarnings("serial")
  public class UserDemographicInfo implements java.io.Serializable {
  
  private long id;
  private String firstName;
  private String lastName;
  private Date dateOfBirth;
  private String mobileNumber;
  private String gender;
  private String status;
  private Address address;
  private String employeeID;
  private String bloodGroup;
  private Date dateCreated;
  private Date dateModified;
  
  public UserDemographicInfo() {
  }
  
  public UserDemographicInfo(String firstName, String lastName,
          Date dateOfBirth, String mobileNumber, String gender,
          String status, Address address, String employeeID,
          String bloodGroup, Date dateCreated, Date dateModified) {
      this.firstName = firstName;
      this.lastName = lastName;
      this.dateOfBirth = dateOfBirth;
      this.mobileNumber = mobileNumber;
      this.gender = gender;
      this.status = status;
      this.address = address;
      this.employeeID = employeeID;
      this.bloodGroup = bloodGroup;
      this.dateCreated = dateCreated;
      this.dateModified = dateModified;
  }
  
  public long getId() {
      return this.id;
  }
  
  public void setId(long id) {
      this.id = id;
  }
  
  public String getFirstName() {
      return this.firstName;
  }
  
  public void setFirstName(String firstName) {
      this.firstName = firstName;
  }
  
  public String getLastName() {
      return this.lastName;
  }
  
  public void setLastName(String lastName) {
      this.lastName = lastName;
  }
  
  public Date getDateOfBirth() {
      return this.dateOfBirth;
  }
  
  public void setDateOfBirth(Date dateOfBirth) {
      this.dateOfBirth = dateOfBirth;
  }
  
  public String getMobileNumber() {
      return this.mobileNumber;
  }
  
  public void setMobileNumber(String mobileNumber) {
      this.mobileNumber = mobileNumber;
  }
  
  public String getGender() {
      return this.gender;
  }
  
  public void setGender(String gender) {
      this.gender = gender;
  }
  
  public String getStatus() {
      return this.status;
  }
  
  public void setStatus(String status) {
      this.status = status;
  }
  
  public Address getAddress() {
      return this.address;
  }
  
  public void setAddress(Address address) {
      this.address = address;
  }
  
  public String getEmployeeID() {
      return this.employeeID;
  }
  
  public void setEmployeeID(String employeeID) {
      this.employeeID = employeeID;
  }
  
  public String getBloodGroup() {
      return this.bloodGroup;
  }
  
  public void setBloodGroup(String bloodGroup) {
      this.bloodGroup = bloodGroup;
  }
  
  public Date getDateCreated() {
      return this.dateCreated;
  }
  
  public void setDateCreated(Date dateCreated) {
      this.dateCreated = dateCreated;
  }
  
  public Date getDateModified() {
      return this.dateModified;
  }
  
  public void setDateModified(Date dateModified) {
      this.dateModified = dateModified;
  }
  
  }  
  </code></pre>
  
  <p>Hibernate.cfg.xml   </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
                                       "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
  &lt;session-factory name="SessionFactory"&gt;
  &lt;property name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
  &lt;property name="hibernate.connection.password"&gt;admin123&lt;/property&gt;
  &lt;property name="hibernate.connection.url"&gt;jdbc:mysql://localhost:3306/ngo&lt;/property&gt;
  &lt;property name="hibernate.connection.username"&gt;root&lt;/property&gt;
  &lt;property name="hibernate.default_schema"&gt;ngo&lt;/property&gt;
  &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
  &lt;property name="current_session_context_class"&gt;thread&lt;/property&gt;
  &lt;mapping resource="com/persistent/progracers/data/pojo/UserDemographicInfo.hbm.xml"/&gt;
  </code></pre>
  
  <p>
     </p>
  
  <p>Now the problem is I am using WaveMaker Studio..It creates one Java Service. So the Java Service Code is here :  </p>
  
  <pre><code>import org.hibernate.Session;
  
  import com.persistent.progracers.data.dao.UserDemographicInfoDAO;
  import com.persistent.progracers.data.pojo.UserDemographicInfo;
  import com.persistent.progracers.wecare.factory.HibernateSessionFactory;
  
  
  public class UserRegistrationService extends com.wavemaker.runtime.javaservice.JavaServiceSuperClass {
  /* Pass in one of FATAL, ERROR, WARN,  INFO and DEBUG to modify your log level;
   *  recommend changing this to FATAL or ERROR before deploying.  For info on these levels, look for tomcat/log4j documentation
   */
  public UserRegistrationService() {
     super(INFO);
  }
  
  public UserDemographicInfo sampleJavaOperation(UserDemographicInfo demopojo) {
     UserDemographicInfoDAO demodao=new UserDemographicInfoDAO();
  
     Session session = HibernateSessionFactory.getSession();
     try {
        log(INFO, "Starting sample operation");
        demodao.persist(demopojo, session);
        log(INFO, "Returning ");
     } catch(Exception e) {
        log(ERROR, "The sample java service operation has failed", e);
     }
     return demopojo;
  }
  
  }
  </code></pre>
  
  <p>There is one service variable in wavemaker which binds all the values to the table's related fields.But It gives me Error when I click on save button </p>
  
  <blockquote>
    <p>:java.lang.IllegalArgumentException: attempt to create saveOrUpdate event with null entity. </p>
  </blockquote>
  
  <p>StackTrace :</p>
  
  <pre><code>INFO (JavaServiceSuperClass.java:155) 22:41:25 - Starting sample operation
  ERROR (JavaServiceSuperClass.java:131) 22:41:26 - The sample java service operation     has failed
  java.lang.IllegalArgumentException: attempt to create saveOrUpdate event with null     entity
     at org.hibernate.event.SaveOrUpdateEvent.(SaveOrUpdateEvent.java:40)
     at org.hibernate.event.SaveOrUpdateEvent.(SaveOrUpdateEvent.java:23)
     at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)
     at       com.persistent.progracers.data.dao.UserDemographicInfoDAO.persist(UserDemographicInfoDAO.java:8)
   at UserRegistrationService.sampleJavaOperation(UserRegistrationService.java:32)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:597)
  at com.wavemaker.runtime.service.reflect.ReflectServiceType.invokeMethod(ReflectServiceType.java:122)
  at com.wavemaker.runtime.server.ServerUtils.invokeMethodWithEvents(ServerUtils.java:303)
  at com.wavemaker.runtime.server.ControllerBase.invokeMethod(ControllerBase.java:269)
  at com.wavemaker.runtime.server.JSONRPCController.executeRequest(JSONRPCController.java:123)
  at com.wavemaker.runtime.server.ControllerBase.handleRequestInternal(ControllerBase.java:125)
  at  org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.jav a:153)
  at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
  at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:788)
  at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:717)
  at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
  at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
  at org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:143)
  at org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:98)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
  </code></pre>
  
  <p>Can anyone please tell me whats the mistake here? </p>