title: How to convert joda DateTime in jpa native query
body: <p>I have an entity with DateTime properties persisted with hibernate</p>
  
  <pre><code>@Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
  @Column(name = "EFF_DT")
  protected DateTime effDt;
  </code></pre>
  
  <p>This all works well and good for regular spring-data-jpa generated queries.</p>
  
  <p>I am trying to add a custom native query</p>
  
  <pre><code> @Query(value = "SELECT COUNT(*) FROM wsa_circuit_state_history ch WHERE ch.eff_dt between ?1 and ?2", nativeQuery = true)
      Integer countEffDateBetween(DateTime start, DateTime end);
  </code></pre>
  
  <p>The error i get is when trying to call this is </p>
  
  <pre><code> java.sql.SQLException: ORA-00932: inconsistent datatypes: expected DATE got BINARY
  </code></pre>
  
  <p>This is the same error i used to get with regular spring-data finders before adding the custom type mapping to my entity</p>
  
  <pre><code> @Type(type = "org.jadira.usertype.dateandtime.joda.PersistentDateTime")
  </code></pre>
  
  <p>How can i make spring-data-jpa/hibernate use the custom type mapping for parameters to native queries?</p>