Uploaded image for project: 'Hibernate ORM'
  1. HHH-8103

Oracle LOB ordering not working with SequenceIdentityGenerator

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 4.1.9, 4.2.0.CR2
    • Fix Version/s: 4.2.1, 4.3.0.Beta2
    • Component/s: hibernate-core
    • Labels:
    • Environment:
      Testet with Hibernate 4.1.9 and 4.2.0.CR2
      Oracle 11g with ojdbc6.jar
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      In the last few days i tried to upgrade an application with an pretty old hibernate3 version to the current hibernate4. It has quite a few entites with LOBs and updates/inserts don't work on such entites anymore. The problem of HHH-4635 Closed seems still to happen in our environment.

      We use a SequenceIdentityGenerator for the ID columns and this seems to be the problem. I made a simpe test project to reproduce it.

      The log looks like this for an insert (longText is the CLOB):

      Hibernate: create table lob_test (id number(19,0) not null, displayName varchar2(120 char), internName varchar2(120 char), longText clob, repository_id number(19,0), version number(19,0), primary key (id))
         ...
      Hibernate: insert into lob_test (id, displayName, internName, longText, repository_id, version) values (hibernate_sequence.nextval, ?, ?, ?, ?, ?)
      02:45:13,279 TRACE BasicBinder:83 - binding parameter [1] as [VARCHAR] - display name
      02:45:13,279 TRACE BasicBinder:83 - binding parameter [2] as [VARCHAR] - intern name
      02:45:13,280 TRACE BasicBinder:83 - binding parameter [3] as [BIGINT] - 42
      02:45:13,280 TRACE BasicBinder:71 - binding parameter [4] as [BIGINT] - <null>
      02:45:13,281 TRACE BasicBinder:83 - binding parameter [5] as [CLOB] - long text
      02:45:13,350  WARN SqlExceptionHelper:143 - SQL Error: 1722, SQLState: 42000
      02:45:13,350 ERROR SqlExceptionHelper:144 - ORA-01722: Ungültige Zahl
      

      The problem should be this id-column

      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private Long id;
      

      ... and our own dialect based on Oracle10gDialect with this addition:

      @Override
      public Class<?> getNativeIdentifierGeneratorClass() {
        return SequenceIdentityGenerator.class;
      }
      

      Also thanks to Danilo Ghirardelli for his test project, which this is based on.

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: