Why has Hibernate switched to use LONG over CLOB?

前端 未结 3 1332
独厮守ぢ
独厮守ぢ 2021-02-04 09:32

It looks like that Hibernate started using LONG data type in version 3.5.5 (we upgraded from 3.2.7) instead of CLOB for the property of type=\"te

3条回答
  •  离开以前
    2021-02-04 10:00

    Can anybody explain why this was done? Should this be raised as a bug?

    This has been done for HHH-3892 - Improve support for mapping SQL LONGVARCHAR and CLOB to Java String, SQL LONGVARBINARY and BLOB to Java byte[] (update of the documentation is tracked by HHH-4878).

    And according to the same issue, the old behavior was wrong.

    (NOTE: currently, org.hibernate.type.TextType incorrectly maps "text" to java.sql.Types.CLOB; this will be fixed by this issue and updated in database dialects)

    You can always raise an issue but in short, my understanding is that you should use type="clob" if you want to get the property mapped to a CLOB.

    PS: Providing your own Dialect and declaring it in your Hibernate configuration (which has nothing to do with a fork) is IMHO not a solution on the long term.

提交回复
热议问题