title: Hibernate "Column --- cannot be null
body: <p>I'm using Hibernate in combination with phpmyadmin (MySQL).
  Recently I found a really weird error.
  Whenever I try to insert a new row (.persist) I get the following error:</p>
  
  <pre><code>com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'user_id' cannot be null
  </code></pre>
  
  <p>The error is really obvious.
  But the weird part is, this error came out of nowhere.
  I'm ENTIRELY sure the property userId (mapped to 'user_id') isn't null. I tested several times.
  This is the mapping part:
  (On the @manytoone part).</p>
  
  <pre><code>  &lt;property name="userId" update="false" insert="false" column="user_id" type="java.lang.Long" /&gt;
  </code></pre>
  
  <p>The OneToMany part isn't the problem I guess.</p>
  
  <p>So the problem here is, i'm 100% sure the value isn't null, still Hibernate passes it as null to the MySQL. (Getter does work).</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>@ManyToOne side, which causes the error</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!DOCTYPE hibernate-mapping PUBLIC
          "-//Hibernate/Hibernate Mapping DTD//EN"
          "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"&gt;
  
  &lt;hibernate-mapping&gt;
      &lt;class name="xx.xx.xx.AlarmEntity" table="alarms"&gt;
          &lt;meta attribute="class-description"&gt;
              Hierin staan de object properties van de alarm entiteit.
          &lt;/meta&gt;
          &lt;id name="id" type="java.lang.Long" column="id"&gt;
              &lt;generator class="native"/&gt;
          &lt;/id&gt;
          &lt;property name="keepsRunning"  type="java.lang.Boolean"&gt;
              &lt;column name="keeps_running" sql-type="int"&gt;&lt;/column&gt;
          &lt;/property&gt;
          &lt;property name="userId" update="false" insert="false" column="user_id" type="java.lang.Long" /&gt;
          &lt;many-to-one name="userAlarm" cascade="save-update" fetch="select" column="user_id" class="xx.xx.xx.UserEntity" /&gt;
      &lt;/class&gt;
  &lt;/hibernate-mapping&gt;
  </code></pre>