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

HHH-2388 : Insert w/ identity column fails on Sybase but no exception occurs

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Won't Fix
    • Affects Version/s: 4.2.0.GA_CP05, 4.3.0.GA_CP03, 4.2.0.GA_CP06, 4.3.0.GA_CP04, 4.2.0.GA_CP07, 4.3.0.GA_CP05, 4.3.0.GA_CP06, 4.2.0.GA_CP08, 4.3.0.GA_CP07, 4.2.0.GA_CP09, 4.3.0.GA_CP08
    • Fix Version/s: TBD
    • Component/s: Hibernate
    • Labels:
      None
    • Affects:
      Release Notes
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      To make it working, use one of the turn around solutions:

      • Use jconn3.jar with DYNAMIC_PREPARE=true option (in Hibenate
        configuration file)
        Example:
        <property name="connection.url">jdbc:sybase:Tds:aurum:1503/masterDb?
        DYNAMIC_PREPARE=true</property>

      OR

      • Use jconn4.jar

      Reason:
      ASE does not throw exception when sql is Parameterized Sql, jconn3.jar uses
      Parameterized Sql for insertion hence no exception is thrown
      By using Dynamic Prepare as 'true' will cause ASE to throw exception.

      Where as jconn4.jar we are using Dynamic Prepared Statement hence exception
      is thrown.

      Note:
      While using jconn3.jar use
      <property name="connection.driver_class">com.sybase.jdbc3.jdbc.SybDriver</
      property>

      And for jconn4.jar use
      <property name="connection.driver_class">com.sybase.jdbc4.jdbc.SybDriver</
      property>

      Show
      To make it working, use one of the turn around solutions: Use jconn3.jar with DYNAMIC_PREPARE=true option (in Hibenate configuration file) Example: <property name="connection.url">jdbc:sybase:Tds:aurum:1503/masterDb? DYNAMIC_PREPARE=true</property> OR Use jconn4.jar Reason: ASE does not throw exception when sql is Parameterized Sql, jconn3.jar uses Parameterized Sql for insertion hence no exception is thrown By using Dynamic Prepare as 'true' will cause ASE to throw exception. Where as jconn4.jar we are using Dynamic Prepared Statement hence exception is thrown. Note: While using jconn3.jar use <property name="connection.driver_class">com.sybase.jdbc3.jdbc.SybDriver</ property> And for jconn4.jar use <property name="connection.driver_class">com.sybase.jdbc4.jdbc.SybDriver</ property>
    • Release Notes Text:
      Hide
      Sybase fails to insert a new entity if the entity overflows the column. However, it does not throw an exception, so Hibernate cannot tell that the insert has failed. To work around this issue, your application must validate entity properties to ensure that the value will not overflow the underlying column. Use one of the following workarounds:

      1. Use jconn3.jar with DYNAMIC_PREPARE=true option (in Hibenate configuration file), and specify the correct JDBC driver. For example:

      <property name="connection.url">jdbc:sybase:Tds:aurum:1503/masterDb? DYNAMIC_PREPARE=true</property>
      <property name="connection.driver_class">com.sybase.jdbc3.jdbc.SybDriver</
      property>

      2. Use jconn4.jar, and specify the correct JDBC driver (in Hibernate configuration file). For example:
      <property name="connection.driver_class">com.sybase.jdbc4.jdbc.SybDriver</property>
      Show
      Sybase fails to insert a new entity if the entity overflows the column. However, it does not throw an exception, so Hibernate cannot tell that the insert has failed. To work around this issue, your application must validate entity properties to ensure that the value will not overflow the underlying column. Use one of the following workarounds: 1. Use jconn3.jar with DYNAMIC_PREPARE=true option (in Hibenate configuration file), and specify the correct JDBC driver. For example: <property name="connection.url">jdbc:sybase:Tds:aurum:1503/masterDb? DYNAMIC_PREPARE=true</property> <property name="connection.driver_class">com.sybase.jdbc3.jdbc.SybDriver</ property> 2. Use jconn4.jar, and specify the correct JDBC driver (in Hibernate configuration file). For example: <property name="connection.driver_class">com.sybase.jdbc4.jdbc.SybDriver</property>
    • Release Notes Docs Status:
      Not Required

      Description

      http://opensource.atlassian.com/projects/hibernate/browse/HHH-2388

      A workaround is that the application validate entity properties to ensure they do not overflow what is defined for the underlying column.

      Because Sybase does not throw an exception, it does indicate an update count of 0. Hibernate does not check the update count so it does not detect that the insert failed.

      According to HHH-2388, Hibernate sets the ID to 0. HHH-2830 (a duplicate issue) says that the ID in the (still) transient entity is set to the previous ID that was generated.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                stliu Strong Liu
                Reporter:
                gbadner Gail Badner
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: