title: Understanding hibernate @Type annotation
body: <p>From the <a href="http://docs.jboss.org/ejb3/app-server/HibernateAnnotations/reference/en/html_single/#d0e2018" rel="noreferrer">official hibernate documentation</a>:</p>
  
  <blockquote>
    <p>@org.hibernate.annotations.Type overrides the default hibernate type
    used: this is generally not necessary since the type is correctly
    inferred by Hibernate</p>
  </blockquote>
  
  <p>There is an example from the documentation:</p>
  
  <pre><code>@Type(type="org.hibernate.test.annotations.entity.MonetaryAmountUserType")
  @Columns(columns = {
      @Column(name="r_amount"),
      @Column(name="r_currency")
  })
  public MonetaryAmount getAmount() {
      return amount;
  }
  </code></pre>
  
  <p>I don't understand that. We declare <code>@Type(type="org.hibernate.test.annotations.entity.MonetaryAmountUserType")</code> but the method's return value has the type <code>MonetaryAmount</code>. </p>
  
  <p>I expected that the type declared within the type annotation and the type of the returned value should be the same type.</p>
  
  <p>Couldn't someone explain the actual purposes of the type, declared within the <code>@Type</code> annotation. Why is it differ from the returned type?</p>