[hibernate-issues] [Hibernate-JIRA] Closed: (HHH-909) Onquoted primary key in IncrementGenerator

Steve Ebersole (JIRA) noreply at atlassian.com
Mon Mar 21 13:01:13 EDT 2011


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

Steve Ebersole closed HHH-909.
------------------------------


Closing stale resolved issues

> Onquoted primary key in IncrementGenerator
> ------------------------------------------
>
>                 Key: HHH-909
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-909
>             Project: Hibernate Core
>          Issue Type: Improvement
>          Components: core
>    Affects Versions: 3.0.5
>            Reporter: Andrey Grebnev
>            Priority: Minor
>             Fix For: 3.1 rc 1
>
>   Original Estimate: 10m
>  Remaining Estimate: 10m
>
> I have examined the source code of Hibernate 3.0.5 and I found following problem.
> In org.hibernate.id.IncrementGenerator we can see the following code
>    if (column==null) column = params.getProperty(PersistentIdentifierGenerator.PK);
>    ...
>    sql = "select max(" + column + ") from " + buf.toString();
> and in
> org.hibernate.mapping.SimpleValue
>   params.setProperty( PersistentIdentifierGenerator.PK, ( (Column) getColumnIterator().next() ).getName() );
> getName() of org.hibernate.mapping.Column returns unquoted string.
> It is very bad because different DBMSes interpret unquoted field names in different manner. E.g. PostgreSQL converts all field names into lowercase and HSQLDB converts all field names into uppercase.
> As result the application built on Hibernate with IncrementGenerator is not portable.
> I offer to change
>   params.setProperty( PersistentIdentifierGenerator.PK, ( (Column) getColumnIterator().next() ).getName() );
> to
>   params.setProperty( PersistentIdentifierGenerator.PK, ( (Column) getColumnIterator().next() ).getQuotedName(dialect) );
> Andrey Grebnev

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