title: @Convert on @Id field
body: <p>I'm trying to </p>
  
  <pre><code>@Id
  @Column(name = "MY_ID_FIELD")
  @Convert(converter = IdConverter.class)
  private Long id;
  </code></pre>
  
  <p>IdConverter is:</p>
  
  <pre><code>@Converter
  public class IdConverter implements AttributeConverter&lt;Long, BigDecimal&gt; {
  
      @Override
      public BigDecimal convertToDatabaseColumn(Long attribute) {
          return BigDecimal.valueOf(attribute);
      }
  
      @Override
      public Long convertToEntityAttribute(BigDecimal dbData) {
          return dbData.longValue();
      }
  }
  </code></pre>
  
  <p>The converter will map BigDecimal, the attribute field type Hibernate expects given that in the sql server database the id column type is numeric, to Long.</p>
  
  <p>I'm using Spring Data Jpa and my repository is using Long as I would expect to</p>
  
  <pre><code>@Repository
  public interface CityRepository extends JpaRepository&lt;City, Long&gt; { }
  </code></pre>
  
  <p>Do you have any idea of why it is not working?</p>