[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-1675) identity generators withy Postgres 8

Jerry Shea (JIRA) noreply at atlassian.com
Mon Sep 15 08:01:10 EDT 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-1675?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=31186#action_31186 ] 

Jerry Shea commented on HHH-1675:
---------------------------------

Postgres has a nice feature to get the generated identity number in the same SQL as the insert clause: INSERT xxxx RETURNING id_column; See http://www.postgresql.org/docs/faqs.FAQ.html#item4.11.1

I've had a look at the PostgresSQLDialect but I can't work out how to generate this SQL from the appendIdentitySelectToInsert(String insertSQL) method - can anyone give me any guidance as to how I can determine the name of the identity column? Thx





> identity generators withy Postgres 8
> ------------------------------------
>
>                 Key: HHH-1675
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1675
>             Project: Hibernate Core
>          Issue Type: Improvement
>          Components: core, documentation
>    Affects Versions: 3.1
>         Environment: Hibernate 3 and Postgres 8, linux
>            Reporter: Robin Demetriades
>   Original Estimate: 0 minutes
>  Remaining Estimate: 0 minutes
>
> I have recently noticed that specifying a generator class = "identity" actually works
> in Postgres as well when the Primary key is of type SERIAL. This however is not reflected in the
> documentation and indeed may just be a happy coincidence rather than by design.
> My improvement request is that this feature be maintained, and even if possible the use of
> the Postgres DEFAULT keyword used as a generator class in the hibernate-mapping XML.
> This undocumented feature has the advantage of skipping an extra database call (as opposed to when generator="sequence") and allowing me to have a unique sequence per table if I so wish so I would be sorry to see it lost as the codebase progresses.
> Rgds,
> Robin Demetriades

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