[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5569) Hibernate should not use LONG type for Oracle

Gail Badner (JIRA) noreply at atlassian.com
Fri Jan 21 23:08:05 EST 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=39745#action_39745 ] 

Gail Badner commented on HHH-5569:
----------------------------------

> Firstly, you did not address the problem raised by this bug: Hibernate is using deprecated database type. Can you provide any rational argument why would Hibernate want to do that?

MySQL and Sybase have a "text" data type, but both map to JDBC LONGVARCHAR. The problem is that Hibernate's "text" type could not be used with MySQL((HHH-3161) or Sybase (HHH-3691)) because it was mapped to CLOB. Hibernate's "text" type was specifically changed to map to LONGVARCHAR to support MySQL and Sybase and other databases that have a "text" data type.

Oracle maps "long" to JDBC LONGVARCHAR, and that is why Hibernate now maps "text" as "long" for Oracle. At the time I worked on this stuff, I did not see any other alternative. Did I miss something?

> Secondly, you broke backwards compatibility (when one Hibernate type suddenly starts to be mapped onto another on a specific Hibernate version). There is nothing in any release notes of Hibernate that mention people need to update from using one type to another.

Yes, you got me on that one, and I'm very sorry about that oversight. I've added this information to a "Hibernate Core Migration Guide : 3.5" at (http://community.jboss.org/docs/DOC-16370). Please let me know if what I wrote is unclear.

> Finally, how would that affect other databases? For example, Hibernate text type is very convenient to use on other databases, such as MySQL.

See above.

> Hibernate should not use LONG type for Oracle
> ---------------------------------------------
>
>                 Key: HHH-5569
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5569
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.5.0.Beta-1
>         Environment: 3.5.0.Beta-1, Oracle 9i
>            Reporter: Mindaugas Žakšauskas
>            Assignee: Gail Badner
>
> This is a spin-off from http://stackoverflow.com/questions/3719905/why-has-hibernate-switched-to-use-long-over-clob/3721717.
> With the changes introduced in HHH-3892 Hibernate started to use Oracle LONG type instead of CLOB for properties of type="text". This is a bad idea because of the following:
> * it creates huge amount of pain for people who depend on Hibernate automatically creating table structure for them. Tables created with the same mapping will have different structure than tables created with earlier version of Hibernate
> * Oracle LONG type has a limitation: there can be _only one_ column of this type within a single table;
> * Oracle has deprecated LONG type many years ago and advised against using this type ever since 8i. See http://www.orafaq.com/wiki/LONG.
> Defining a property to have type="clob" is not really a solution; other databases might have other, more suitable types to store this type of data (not necessarily CLOB).
> At the moment the only workaround is to define custom dialact and use it; but this is a very poor solution in the long term.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the hibernate-issues mailing list