[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5230) Regresion! @SequenceGenerator with allocationSize=1 fails Other allocationSizes appear to be decremented by 1

Steve Ebersole (JIRA) noreply at atlassian.com
Mon May 17 09:57:12 EDT 2010


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

Steve Ebersole commented on HHH-5230:
-------------------------------------

Thats actually how the old hilo generators worked; they had a config parameter named max_lo which is really what JPA terms allocationSize, but less 1.  The code that configures this from annotations automatically does the allocationSize-1 to configure the max_lo.  I simply forgot to account for that in the sequence-based hilo generator and it was missed because there was no testing in place in regards to annotation based configuration of this generator.

You can build the 3.5 branch yourself until this fix is released or switch to the non-legacy generators.

> Regresion! @SequenceGenerator with allocationSize=1 fails Other allocationSizes appear to be decremented by 1
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: HHH-5230
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5230
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: annotations, core
>    Affects Versions: 3.5.2
>            Reporter: Mike Youngstrom
>            Assignee: Steve Ebersole
>
> When I attempt to upgrade to 3.5.2 I get an error on startup. If I change my allocationSize to 2 then it starts up fine but debugging into LegacyHiLoAlgorithmOptimizer it appears to be using a value of 1.
> Caused by: javax.persistence.PersistenceException: [PersistenceUnit: org.lds.stack.stack-pet-store-ws] Unable to build EntityManagerFactory
> at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:896)
> at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
> at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:225)
> at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:308)
> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
> at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
> ... 38 more
> Caused by: org.hibernate.MappingException: Could not instantiate id generator [entity-name=org.lds.stack.petstore.model.Animal]
> at org.hibernate.id.factory.DefaultIdentifierGeneratorFactory.createIdentifierGenerator(DefaultIdentifierGeneratorFactory.java:117)
> at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:178)
> at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:257)
> at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1385)
> at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:954)
> at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:887)
> ... 43 more
> Caused by: org.hibernate.HibernateException: increment size cannot be less than 1
> at org.hibernate.id.enhanced.OptimizerFactory$LegacyHiLoAlgorithmOptimizer.<init>(OptimizerFactory.java:336)
> at org.hibernate.id.SequenceHiLoGenerator.configure(SequenceHiLoGenerator.java:64)
> at org.hibernate.id.factory.DefaultIdentifierGeneratorFactory.createIdentifierGenerator(DefaultIdentifierGeneratorFactory.java:110)
> ... 48 more

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