[hibernate-issues] [Hibernate-JIRA] Updated: (HHH-6580) Discriminator value used as ID when inserting entity to PosgtreSQL

Steve Ebersole (JIRA) noreply at atlassian.com
Wed Jan 25 16:56:14 EST 2012


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

Steve Ebersole updated HHH-6580:
--------------------------------

    Pull Requests: https://github.com/hibernate/hibernate-core/pull/243  (was: https://github.com/hibernate/hibernate-core/pull/243)
         Assignee: Steve Ebersole

> Discriminator value used as ID when inserting entity to PosgtreSQL
> ------------------------------------------------------------------
>
>                 Key: HHH-6580
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6580
>             Project: Hibernate ORM
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.6.0
>         Environment: Tested on Hibernate 3.6.0, but I looked in the code of 3.6.6 and 4.0.0 Beta4 and it looks like it isn't fixed.
> PostgreSQL 8.4.8
>            Reporter: Paweł Stawicki
>            Assignee: Steve Ebersole
>              Labels: generated
>         Attachments: amorfis-Hibernate-postgreSQL-bug-3ef4fb0.zip
>
>
> When we have inheritance strategy SINGLE_TABLE, and we use discriminator column, this column is the first one in table. Now we want to insert some entity inheriting from this one, and we want PostgreSQL to automatically generate the ID for the new entity. Discriminator column is the first in the table.
> Hibernate runs IdentityGenerator.GetGeneratedKeysDelegate.executeAndExtract(), which gets ResultSet from PreparedStatement (in Hibernate 3.6.0 it's line 97 in IdentityGenerator). 
> This ResultSet, in case of PostgreSQL, contains whole inserted row, not only ID. This is the problem if ID is not the first column, because then Hibernate get's value from the first column and uses it as ID. It's in IdentifierGeneratorHelper.getGeneratedIdentity() and IdentifierGeneratorHelper.get().

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the hibernate-issues mailing list