HHH-4884 - Fix binding of @TableGenerator#initialValue into org.hibernate.id.enhanced.TableGenerator
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18704 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
edf5e9652d
commit
5c16c01064
|
@ -387,7 +387,8 @@ public final class
|
||||||
idGen.addParam( org.hibernate.id.enhanced.TableGenerator.VALUE_COLUMN_PARAM, tabGen.valueColumnName() );
|
idGen.addParam( org.hibernate.id.enhanced.TableGenerator.VALUE_COLUMN_PARAM, tabGen.valueColumnName() );
|
||||||
}
|
}
|
||||||
idGen.addParam( org.hibernate.id.enhanced.TableGenerator.INCREMENT_PARAM, String.valueOf( tabGen.allocationSize() ) );
|
idGen.addParam( org.hibernate.id.enhanced.TableGenerator.INCREMENT_PARAM, String.valueOf( tabGen.allocationSize() ) );
|
||||||
idGen.addParam( org.hibernate.id.enhanced.TableGenerator.INITIAL_PARAM, String.valueOf( tabGen.initialValue() ) );
|
// See comment on HHH-4884 wrt initialValue. Basically initialValue is really the stated value + 1
|
||||||
|
idGen.addParam( org.hibernate.id.enhanced.TableGenerator.INITIAL_PARAM, String.valueOf( tabGen.initialValue() + 1 ) );
|
||||||
if ( tabGen.uniqueConstraints() != null && tabGen.uniqueConstraints().length > 0 ) {
|
if ( tabGen.uniqueConstraints() != null && tabGen.uniqueConstraints().length > 0 ) {
|
||||||
log.warn( "Ignoring unique constraints specified on table generator [{}]", tabGen.name() );
|
log.warn( "Ignoring unique constraints specified on table generator [{}]", tabGen.name() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,8 @@ package org.hibernate.test.annotations.id;
|
||||||
|
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.Transaction;
|
import org.hibernate.Transaction;
|
||||||
|
import org.hibernate.cfg.AnnotationConfiguration;
|
||||||
|
import org.hibernate.cfg.Configuration;
|
||||||
import org.hibernate.mapping.Column;
|
import org.hibernate.mapping.Column;
|
||||||
import org.hibernate.test.annotations.TestCase;
|
import org.hibernate.test.annotations.TestCase;
|
||||||
import org.hibernate.test.annotations.id.entities.Ball;
|
import org.hibernate.test.annotations.id.entities.Ball;
|
||||||
|
@ -298,4 +300,8 @@ public class IdTest extends TestCase {
|
||||||
return new String[] { "org/hibernate/test/annotations/orm.xml" };
|
return new String[] { "org/hibernate/test/annotations/orm.xml" };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure(Configuration cfg) {
|
||||||
|
cfg.setProperty( AnnotationConfiguration.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
|
* indicated by the @author tags or express copyright attribution
|
||||||
|
* statements applied by the authors. All third-party contributions are
|
||||||
|
* distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.hibernate.test.annotations.id;
|
||||||
|
|
||||||
|
import org.hibernate.cfg.AnnotationConfiguration;
|
||||||
|
import org.hibernate.cfg.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO : javadoc
|
||||||
|
*
|
||||||
|
* @author Steve Ebersole
|
||||||
|
*/
|
||||||
|
public class NewSchemeIdTest extends IdTest {
|
||||||
|
@Override
|
||||||
|
protected void configure(Configuration cfg) {
|
||||||
|
cfg.setProperty( AnnotationConfiguration.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,8 @@ package org.hibernate.test.annotations.id.sequences;
|
||||||
|
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.Transaction;
|
import org.hibernate.Transaction;
|
||||||
|
import org.hibernate.cfg.AnnotationConfiguration;
|
||||||
|
import org.hibernate.cfg.Configuration;
|
||||||
import org.hibernate.mapping.Column;
|
import org.hibernate.mapping.Column;
|
||||||
import org.hibernate.test.annotations.TestCase;
|
import org.hibernate.test.annotations.TestCase;
|
||||||
import org.hibernate.test.annotations.id.sequences.entities.Ball;
|
import org.hibernate.test.annotations.id.sequences.entities.Ball;
|
||||||
|
@ -305,4 +307,9 @@ public class IdTest extends TestCase {
|
||||||
return new String[] { "org/hibernate/test/annotations/orm.xml" };
|
return new String[] { "org/hibernate/test/annotations/orm.xml" };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void configure(Configuration cfg) {
|
||||||
|
cfg.setProperty( AnnotationConfiguration.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* Hibernate, Relational Persistence for Idiomatic Java
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010, Red Hat Inc. or third-party contributors as
|
||||||
|
* indicated by the @author tags or express copyright attribution
|
||||||
|
* statements applied by the authors. All third-party contributions are
|
||||||
|
* distributed under license by Red Hat Inc.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||||
|
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||||
|
* Lesser General Public License, as published by the Free Software Foundation.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||||
|
* for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this distribution; if not, write to:
|
||||||
|
* Free Software Foundation, Inc.
|
||||||
|
* 51 Franklin Street, Fifth Floor
|
||||||
|
* Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
package org.hibernate.test.annotations.id.sequences;
|
||||||
|
|
||||||
|
import org.hibernate.cfg.AnnotationConfiguration;
|
||||||
|
import org.hibernate.cfg.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TODO : javadoc
|
||||||
|
*
|
||||||
|
* @author Steve Ebersole
|
||||||
|
*/
|
||||||
|
public class NewSchemeIdTest extends IdTest {
|
||||||
|
@Override
|
||||||
|
protected void configure(Configuration cfg) {
|
||||||
|
cfg.setProperty( AnnotationConfiguration.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue