Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-4599

HHH-3231 org.hibernate.id.enhanced.TableGenerator throws "IllegalArgumentException: alias not found: tbl" under Oracle

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.3.0.GA_CP08
    • Fix Version/s: 4.3.0.GA_CP09
    • Component/s: Hibernate
    • Labels:
      None
    • Environment:

      Hibernate 3.2.6GA, Oracle 10g

    • Affects:
      Release Notes
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Use the enhanced sequence style generator to force Hibernate to use a table instead of a sequence.

      Show
      Use the enhanced sequence style generator to force Hibernate to use a table instead of a sequence.
    • Release Notes Text:
      Hide
      A bug in Hibernate caused the following exception to be thrown <errortext>java.lang.IllegalArgumentException: alias not found: tbl </errortext>. A table object could not be saved to Oracle. A temporary workaround was devised to use an enhanced sequence instead, but this was not an optimal solution. The Hibernate code was updated to fix this flaw. Table objects are now able to be saved to Oracle, as expected.
      Show
      A bug in Hibernate caused the following exception to be thrown <errortext>java.lang.IllegalArgumentException: alias not found: tbl </errortext>. A table object could not be saved to Oracle. A temporary workaround was devised to use an enhanced sequence instead, but this was not an optimal solution. The Hibernate code was updated to fix this flaw. Table objects are now able to be saved to Oracle, as expected.
    • Release Notes Docs Status:
      Documented as Resolved Issue

      Description

      org.hibernate.id.enhanced.TableGenerator always throws the following exception if I want to save a new object to Oracle:
      java.lang.IllegalArgumentException: alias not found: tbl
      at org.hibernate.sql.ForUpdateFragment.<init>(ForUpdateFragment.java:36)
      at org.hibernate.dialect.Dialect.applyLocksToSql(Dialect.java:970)
      at org.hibernate.id.enhanced.TableGenerator.configure(TableGenerator.java:194)
      at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:104)

      I attach an example to this case. The example is loosely based on the tutorial example, that comes with Hibernate. It contains a Person object that is saved to db using the enhanced.TableGenerator as id generator. To keep the zip small only the jars of jdbc driver are included, the jars needed from hibernate distribution are listed in lib/readme.txt.

      The zip also contains a modified TableGenerator that works with Oracle. This version was made by forum user stomp and more information about it can be read here: http://forum.hibernate.org/viewtopic.php?t=980933
      It changes the 194th row of TableGenerator from
      this.query = dialect.applyLocksToSql( query, lockMap, CollectionHelper.EMPTY_MAP );
      to
      this.query = dialect.applyLocksToSql( query, lockMap, Collections.singletonMap("tbl", new String[]

      {valueColumnName}

      ) );

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  stliu Strong Liu
                  Reporter:
                  sjmenden Samuel Mendenhall
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: