title: How to handle two different Date libraries with same JPA Attribute Converters
body: <p>In my Java EE project I'm using JPA 2.1 to get data from my Oracle DB. I mostly use Named and Criteria queries. The problem occurs when using Aliases with type of Tuple, which uses <em>java.util.Date</em>. But the other Named and Criteria queries uses <em>java.sql.Date</em> for LocalDate Converter. </p>
  
  <p>So my JPA Attribute Converters look like this:</p>
  
  <p>[using java.sql.Date]</p>
  
  <pre><code>import java.sql.Date;
  ...
  @Converter(autoApply = true)
  public class LocalDateAttributeConverter1 implements AttributeConverter&lt;LocalDate, Date&gt; {
      // Implementation
  }
  </code></pre>
  
  <p>And </p>
  
  <p>[using java.util.Date]</p>
  
  <pre><code>import java.util.Date;
  ...
  @Converter(autoApply = true)
  public class LocalDateAttributeConverter2 implements AttributeConverter&lt;LocalDate, Date&gt; {
      // Implementation
  }
  </code></pre>
  
  <p>When using both of them in my project, there are problems with one of them when converting JDBC types to Java classes.</p>
  
  <p>So is there any way to use both of Converters in my project?</p>