glassfish
  1. glassfish
  2. GLASSFISH-3307

Temp Table creation problem, Toplink not making use of explicit Column type set in entity mapping XML

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 9.1pe
    • Fix Version/s: 9.1pe
    • Component/s: entity-persistence
    • Labels:
      None
    • Environment:

      Operating System: Linux
      Platform: Linux

    • Issuezilla Id:
      3,307

      Description

      Even though I have an explicit entry in the XML entity mapping file (which is
      used correctly when creating the main table), when the matching temporary table
      is created it fails because it has used the default column type.

      This is against MySQL 4.0.24 on Solaris 10 x86, using TopLink, version: Oracle
      TopLink Essentials - 2.0 (Build 54 (07/03/2007)) and JDBC driver
      mysql-connector-java-5.0.5.

      Snippet from entity mapping XML:

      <entity class="nz.co.dereeper.trafficreports.base.domain.Archive">
      <description>This is required to enable the correct operation when this
      entity is used against MySQL</description>
      <attribute-override name="rawdata">
      <column column-definition="MEDIUMBLOB"/>
      </attribute-override>
      </entity>

      Example of main table creation, logs show correct column type of MEDIUMBLOB for
      column RAWDATA:

      [TopLink Fine]: 2007.07.08
      06:22:51.882-ServerSession(798740)Connection(20453728)Thread(Thread[main,5,main])-CREATE
      TABLE archive (ID BIGINT AUTO_INCREMENT NOT NULL, ARCHIVE_TYPE CHAR(1) NOT NULL,
      ARCHIVE_SIZE INTEGER NOT NULL, RAWDATA MEDIUMBLOB, ISPROCESSED TINYINT(1)
      default 0 NOT NULL, EXTRACT_ID BIGINT, PRIMARY KEY (ID))

      Example of incorrect temporary table creation, here logs show column type is set
      to the default of BLOB(64000) rather than MEDIUMBLOB for column RAWDATA:

      [TopLink Fine]: 2007.07.08
      06:22:55.680-ClientSession(17601703)Connection(20263497)Thread(Thread[main,5,main])-CREATE
      TEMPORARY TABLE IF NOT EXISTS TL_archive (ID BIGINT NOT NULL, ARCHIVE_TYPE
      CHAR(1), ARCHIVE_SIZE INTEGER, RAWDATA BLOB(64000), ISPROCESSED TINYINT(1)
      default 0, EXTRACT_ID BIGINT, PRIMARY KEY (ID))
      [TopLink Fine]: 2007.07.08
      06:22:55.693-ClientSession(17601703)Connection(20263497)Thread(Thread[main,5,main])-INSERT
      INTO TL_archive (ID, ISPROCESSED) SELECT t1.ID, ? FROM extracts t0, archive t1
      WHERE (t0.ID IN (?, ?) AND (t0.ID = t1.EXTRACT_ID))
      bind => [false, 1, 2]
      [TopLink Fine]: 2007.07.08
      06:22:55.695-ClientSession(17601703)Connection(20263497)Thread(Thread[main,5,main])-DELETE
      FROM TL_archive
      [TopLink Warning]: 2007.07.08
      06:22:55.695-UnitOfWork(24869286)Thread(Thread[main,5,main])-Local Exception
      Stack:
      Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build 54
      (07/03/2007))): oracle.toplink.essentials.exceptions.DatabaseException
      Internal Exception: com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table
      'trafficreports2.TL_archive' doesn't exist

        Activity

        Hide
        gfbugbridge added a comment -

        <BT6578014>

        Show
        gfbugbridge added a comment - <BT6578014>
        Hide
        pkrogh added a comment -

        Assign to Kyle.

        Show
        pkrogh added a comment - Assign to Kyle.
        Hide
        pkrogh added a comment -

        starting

        Show
        pkrogh added a comment - starting
        Hide
        kylechen added a comment -

        The code has been fixed by picking up column definition if it was defined
        during create temp table sql gets prepared.

        Show
        kylechen added a comment - The code has been fixed by picking up column definition if it was defined during create temp table sql gets prepared.

          People

          • Assignee:
            kylechen
            Reporter:
            markdr
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: