[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5208) Oracle 11g R2 RAC - Test SequenceIdentityTest fails because first value of sequence is "2"

Mike Youngstrom (JIRA) noreply at atlassian.com
Sat May 15 19:21:24 EDT 2010


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

Mike Youngstrom commented on HHH-5208:
--------------------------------------

I wonder if fixing this issue might have caused a regression.  In my application I'm using Oracle and @SequenceGenerator with an allocationSize=1 after upgrading to 3.5.2 I get the following error on startup:  If I change my allocationSize to 2 then it starts up fine.


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

> Oracle 11g R2 RAC - Test SequenceIdentityTest fails because first value of sequence is "2"
> ------------------------------------------------------------------------------------------
>
>                 Key: HHH-5208
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5208
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.5.1, 3.5.x
>         Environment: Oracle 11g R2 (RAC)
>            Reporter: Strong Liu
>            Assignee: Strong Liu
>             Fix For: 3.5.2, 3.6
>
>
> Starting with Oracle 11g R2 (RAC), the behavior of the CREATE TABLE statement has changed, when creating a conventional table in a database created with the default options then the initial segment is not created until the first row is inserted into the table.
> see http://download.oracle.com/docs/cd/E11882_01/server.112/e10595/tables002.htm#ADMIN13319 for more details.
> We found a potential downside to this change :
> The sequences created as default ( start with 1 increment by 1) are not staring with '1′ when used in insert query script, Instead they are starting with 2 or 4, this can not be changed even explicitly tell Oracle that the first value is "1".
> In another words, when using Hibernate with Oracle 11g R2 (RAC), if the ID generator class is "sequence-identity", the first value is NOT 1.
> Two ways to work around this issue:
> 1. Using another ID generator class.
> 2. Disable deferred segment creation of Oracle by setting the initialization parameter DEFERRED_SEGMENT_CREATION to FALSE. The new clauses SEGMENT CREATION DEFERRED and SEGMENT CREATION IMMEDIATE are available for the CREATE TABLE statement. These clauses override the setting of the DEFERRED_SEGMENT_CREATION initialization parameter.

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