title: How to map Oracle Object type in an entity using Spring Data JPA?
body: <p>This question is particularly related to mapping Oracle object type in an entity using Spring Data JPA. The <a href="https://stackoverflow.com/questions/14600155/oracle-database-object-type-import-in-java">other question</a> did not help explain the problem in detail.</p>
  
  <p>So here below are details:</p>
  
  <p>I could not find information related to mapping Oracle object type in entity objects with Spring Data JPA neither in Spring Data JPA Reference nor in any other search results.</p>
  
  <p>Scenario:</p>
  
  <p>Let's say I have the following <strong>date_typ</strong> Oracle type.</p>
  
  <pre><code>CREATE TYPE date_typ AS OBJECT (
    month         VARCHAR2(2),
    day           VARCHAR2(2),
    year          VARCHAR2(4),
    extension     VARCHAR2(10),
    MEMBER FUNCTION getFullDate RETURN VARCHAR2
  );
  
  CREATE TYPE BODY date_typ AS
    MAP MEMBER FUNCTION getFullDate RETURN VARCHAR2 AS
    BEGIN
      return month || day || year;
   END getFullDate;
  END;
  </code></pre>
  
  <p>Now in the oracle database table, say REGISTRATION, one of the columns is of the above date_typ </p>
  
  <pre><code>Column      Type
  REG_ID      VARCHAR2(25)  primary key
  FIRSTNAME   VARCHAR2(30)  not null
  LASTNAME    VARCHAR2(30)  not null
  MIDDLEINIT  VARCHAR2(10) 
  REQUESTEDDATE DATE_TYP
  ...
  ...
  </code></pre>
  
  <p>Now, I need to map the above columns in the entity</p>
  
  <pre><code>@Entity
  @Table(name = "REGISTRATION", schema = "accounts")
  public class RegistrationEntity {
      @Id
      @Column(name = "REG_ID")
      private String registrationId;
  
      @Column(name = "FIRSTNAME", nullable = false)
      private String firstName;
  
      @Column(name = "LASTNAME", nullable = false)
      private String lastName;
  
      @Column(name = "MIDDLEINIT")
      private String middleInitial;
  
      requestedDate ???
  }
  </code></pre>
  
  <p>How do I map the <code>requestedDate</code> to the <code>REQUESTEDDATE</code> column of the <strong>DATE_TYP</strong> (oracle object type) in Spring JPA?</p>
  
  <p>Notes: am using Hibernate as the persistence provider.</p>