title: Hibernate with long text column with Oracle and PostgreSQL
body: <p>I'm trying make an entity work with Oracle (11.2) and PostgreSQL(9.4) in a Spring Boot (1.4.4) application.</p>
  
  <p>My entity contains a long text field (over 4000 characters).
  The appropriate data type in Oracle is CLOB and the corresponding type in PostgreSQL is TEXT.</p>
  
  <p>I'm able to make it work with PostgreSQL</p>
  
  <pre><code>@Column(name = "LONG_TEXT", columnDefinition="TEXT")
  private String longText;
  </code></pre>
  
  <p>However it would fail with Oracle in hibernate validation stage since CLOB requires @Lob annotation.</p>
  
  <p>The following code works with Oracle</p>
  
  <pre><code>@Lob
  @Column(name = "LONG_TEXT")
  private String longText;
  </code></pre>
  
  <p>However this time it fails when reading from PostgreSQL with the following exception:</p>
  
  <blockquote>
    <p>PSQLException: Large Objects may not be used in auto-commit mode</p>
  </blockquote>
  
  <p><a href="https://stackoverflow.com/questions/3164072/large-objects-may-not-be-used-in-auto-commit-mode">Stack overflow suggests</a> performing queries in transactions. Disregarding questionable requirement to invoke transaction in select queries, adding @Transactional to query methods didn't help.</p>
  
  <p>Any thoughts are more than welcomed.</p>