title: Why do the Oracle hibernate dialects produce invalid schemas?
body: <p>In my project, I need to support multiple databases from multiple vendors (notably, Oracle, MSSQL and MySQL).</p>
  
  <p>I have a class which creates <code>.sql</code> files for each DB type based on my annotated hibernate model classes.</p>
  
  <p>I have a class <code>MyEntity.java</code> like this:</p>
  
  <pre><code>@Entity
  @Table(name = "my_table")
  public class MyEntity implements java.io.Serializable {
  
      private Integer id;
      private Date timestamp;
      private String data;
  
      public MyEntity() {
      }
  
      @Id
      @SequenceGenerator(name = "my_table_seq", sequenceName = "my_table_seq")
      @GeneratedValue(strategy = GenerationType.AUTO, generator = "my_table_seq")
      @Column(name = "id", unique = true, nullable = false)
      public Integer getId() {
          return this.id;
      }
  
      public void setId(Integer id) {
          this.id = id;
      }
  
      @Temporal(TemporalType.TIMESTAMP)
      @Column(name = "timestamp", nullable = false)
      public Date getTimestamp() {
          return this.timestamp;
      }
  
      public void setTimestamp(Date timestamp) {
          this.timestamp = timestamp;
      }
  
      @Column(name = "data", length = 65535)
      public String getData() {
          return this.data;
      }
  
      public void setData(String data) {
          this.data = data;
      }
  }
  </code></pre>
  
  <p>This class was produced by <code>hbm2java</code> using reverse engineering from a MySQL database. The "data" column was a <code>TEXT</code> and the "timestamp" column was a <code>TIMESTAMP</code>.</p>
  
  <p>When I use the <code>SchemaExporter</code> class to generate SQL for other DB types (like oracle for example) it produces invalid plsql. This class (using the <code>Oracle10gDialect</code> produces oracle sql like this:</p>
  
  <pre><code>create table my_table (
      id integer not null,
      data varchar(65535),
      timestamp datetime not null
  );
  </code></pre>
  
  <p><code>varchar(65535)</code> is invalid because varchars can't be that long, and <code>datetime</code> is apparently not a real datatype.</p>
  
  <p>When using the MySQL dialect, it correctly defines "data" as a <code>MEDIUMTEXT</code> type.</p>
  
  <p>Why does it generate invalid oracle SQL? Is there some way I can hint to hibernate that it should use a text type? Or am I going to have to extend the oracle dialect to fix up all the data types?</p>
  
  <p><strong>Note</strong>: I'm using oracle 11.2.0.2.v7 and hibernate 4.2.8.FINAL<br>
  <strong>Another Note</strong>: Similar invalid results are produced for MSSQL (varchar(65535) is invalid).<br>
  <strong>Disclaimer</strong>: I'm new to Oracle</p>