[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-3519) account for parameters in select clause of INSERT-SELECT for DB2

Steve Ebersole (JIRA) noreply at atlassian.com
Thu Oct 9 11:54:05 EDT 2008


     [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-3519?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Steve Ebersole updated HHH-3519:
--------------------------------

      Description: 
DB2 is somewhat restrictive in terms of where/how parameters can occur.  

One such restriction is that parameters in a select clause must be wrapped by a call to the CAST() function  so that the DB2 parser can determine the datatype to expect.

In the case of an HQL INSERT statement with a versioned entity where the version is VM-based, Hibernate generates an INSERT-SELECT statement in which it attempts to set the inserted row's version using a parameter.  For that usage, at minimum we need to account for this CAST() wrapping.

  was:
DB2 does not support an untyped parameter in INSERT INTO ... SELECT ... ? ... ; however, DB2 will support a parameter if it is cast as an appropriate data type.

For example:
INSERT INTO ... SELECT ... CAST(? AS TIMESTAMP) ... .

Since Hibernate modifies insert SQL to update timestamps, this really needs to be fixed.

    Fix Version/s: 3.4
      Environment: DB2
          Summary: account for parameters in select clause of INSERT-SELECT for DB2  (was: VM-based,timestamps are not generated for DB2 )

> account for parameters in select clause of INSERT-SELECT for DB2
> ----------------------------------------------------------------
>
>                 Key: HHH-3519
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3519
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.2.6, 3.3.1
>         Environment: DB2
>            Reporter: Gail Badner
>            Assignee: Steve Ebersole
>             Fix For: 3.2.x, 3.3.x, 3.4
>
>
> DB2 is somewhat restrictive in terms of where/how parameters can occur.  
> One such restriction is that parameters in a select clause must be wrapped by a call to the CAST() function  so that the DB2 parser can determine the datatype to expect.
> In the case of an HQL INSERT statement with a versioned entity where the version is VM-based, Hibernate generates an INSERT-SELECT statement in which it attempts to set the inserted row's version using a parameter.  For that usage, at minimum we need to account for this CAST() wrapping.

-- 
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