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

Dylan (JIRA) noreply at atlassian.com
Fri Oct 19 12:06:39 EDT 2007


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

Dylan commented on HHH-1675:
----------------------------

I found this in PostgreSQLDialect.java:

	public String getIdentityColumnString(int type) {
		return type==Types.BIGINT ?
			"bigserial not null" :
			"serial not null";
	}

and also 
	public String getSelectSequenceNextValString(String sequenceName) {
		return "nextval ('" + sequenceName + "')";
	}

So it looks me like this feature is intentional.

Adding this to the docs would be good.

> identity generators withy Postgres 8
> ------------------------------------
>
>                 Key: HHH-1675
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1675
>             Project: Hibernate3
>          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