[hibernate-issues] [Hibernate-JIRA] Commented: (ANN-592) @TableGenerator realisation does not respect initialValue

Tim Vollmer (JIRA) noreply at atlassian.com
Wed Mar 12 00:13:34 EDT 2008


    [ http://opensource.atlassian.com/projects/hibernate/browse/ANN-592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_29766 ] 

Tim Vollmer commented on ANN-592:
---------------------------------


As one quick and dirty method, you can add an insert statement to your import.sql file.  For the value, use the desired initialValue divided by the allocationSize.  For an initialValue of 1000, using an allocationSize of 50, use 20.

insert into hibernate_sequences (sequence_name, sequence_next_hi_value) values ('yourTableName', 20)

> @TableGenerator realisation does not respect initialValue
> ---------------------------------------------------------
>
>                 Key: ANN-592
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/ANN-592
>             Project: Hibernate Annotations
>          Issue Type: Bug
>          Components: binder
>    Affects Versions: 3.3.0.ga
>            Reporter: Christoph Schönfeld
>            Priority: Minor
>
> I would like to have generated IDs for a certain entity type start at the value of 1000.
> Consider the following example.
> @TableGenerator(name = "employee", 
> table = "SEQUENCES", 
> pkColumnName = "name", 
> valueColumnName = "value", 
> pkColumnValue = "employee", 
> allocationSize = 10, 
> initialValue = 1000)
> Hibernate generates the SEQUENCES table correctly but it always returns 1 as the first generated key. 
> In the source code of AnnotationBinder.java which seems to be responsible for binding the @TableGenerator annotation to a MultipleHiLoPerTableGenerator instance  the initialValue property is ignored.

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