title: Hibernate ConstraintValidation while running Junit
body: <p>I am working on an enhancement to create a new Table A and reference the id of that as a new column in an existing Table B</p>
  
  <p>I have omitted the entire entity class for brevity.</p>
  
  <pre><code>import javax.validation.constraints.NotNull;
  import org.apache.bval.constraints.NotEmpty;    
  public class TableB implements Serializable {
      --
      @NotNull
          @NotEmpty
          @Column(name = "ContactReasonID")
          private Integer contactReasonID;
      ---
      }
  </code></pre>
  
  <p>My Junit Test method is listed below</p>
  
  <pre><code>@Test
  public void testUpdateInteraction(){
      try {
          interactionService.updateTableB(228, 2, 2642, "test");
          assertTrue(true);
      } catch (Exception e) {
          assertTrue(false);
      }       
  }
  </code></pre>
  
  <p>The parameters for updateTableB are all referring to the old columns.
  But when I run the test case I am getting a ConstraintViolationException as shown below</p>
  
  <pre><code>[ConstraintViolationImpl{rootBean=net.ashwin.entity.TableB@174d3343, propertyPath='contactReasonID', message='may not be null', leafBean=net.ashwin.entity.TableB@174d3343, value=null}]
  </code></pre>
  
  <p>But the contactReasonID is a nullable column. I am baffled as to where the constraint is. </p>
  
  <p>Environment details:</p>
  
  <pre><code> &lt;spring-framework.version&gt;3.1.2.RELEASE&lt;/spring-framework.version&gt;                 &lt;spring-data-jpa&gt;1.4.4.RELEASE&lt;/spring-data-jpa&gt;
      &lt;hibernate-framework.version&gt;4.0.1.Final&lt;/hibernate-framework.version&gt;
  </code></pre>
  
  <p>Any pointers or guidance would be of great help.</p>