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

Strong Liu (JIRA) noreply at atlassian.com
Sat May 8 15:42:48 EDT 2010


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

Strong Liu commented on HHH-5208:
---------------------------------

from Juca:
A small test which can be reproduced directly in Oracle (in our lab) shows it's not a problem in the driver nor in Hibernate: 

create table my_entity (id number(19,0) not null, name varchar2(255 char) not null, primary key (id), unique (name)); 
create sequence hibernate_sequence; 
insert into my_entity (id, name) values (hibernate_sequence.nextval, 'test'); 
--- the ID for the record above is 2 
delete from my_entity; 
drop sequence hibernate_sequence; 
create sequence hibernate_sequence; 
insert into my_entity (id, name) values (hibernate_sequence.nextval, 'test'); 
--- the ID for the record above is 1 

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