[hibernate-commits] Hibernate SVN: r18704 - in core/trunk/annotations/src: test/java/org/hibernate/test/annotations/id and 1 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Fri Feb 5 13:28:39 EST 2010


Author: steve.ebersole at jboss.com
Date: 2010-02-05 13:28:39 -0500 (Fri, 05 Feb 2010)
New Revision: 18704

Added:
   core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/NewSchemeIdTest.java
   core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/NewSchemeIdTest.java
Modified:
   core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java
   core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/IdTest.java
   core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/IdTest.java
Log:
HHH-4884 - Fix binding of @TableGenerator#initialValue into org.hibernate.id.enhanced.TableGenerator


Modified: core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java
===================================================================
--- core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java	2010-02-05 16:29:21 UTC (rev 18703)
+++ core/trunk/annotations/src/main/java/org/hibernate/cfg/AnnotationBinder.java	2010-02-05 18:28:39 UTC (rev 18704)
@@ -387,7 +387,8 @@
 					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.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 ) {
 					log.warn( "Ignoring unique constraints specified on table generator [{}]", tabGen.name() );
 				}

Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/IdTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/IdTest.java	2010-02-05 16:29:21 UTC (rev 18703)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/IdTest.java	2010-02-05 18:28:39 UTC (rev 18704)
@@ -3,6 +3,8 @@
 
 import org.hibernate.Session;
 import org.hibernate.Transaction;
+import org.hibernate.cfg.AnnotationConfiguration;
+import org.hibernate.cfg.Configuration;
 import org.hibernate.mapping.Column;
 import org.hibernate.test.annotations.TestCase;
 import org.hibernate.test.annotations.id.entities.Ball;
@@ -298,4 +300,8 @@
 		return new String[] { "org/hibernate/test/annotations/orm.xml" };
 	}
 
+	@Override
+	protected void configure(Configuration cfg) {
+		cfg.setProperty( AnnotationConfiguration.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );
+	}
 }

Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/NewSchemeIdTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/NewSchemeIdTest.java	                        (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/NewSchemeIdTest.java	2010-02-05 18:28:39 UTC (rev 18704)
@@ -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" );
+	}
+}

Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/IdTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/IdTest.java	2010-02-05 16:29:21 UTC (rev 18703)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/IdTest.java	2010-02-05 18:28:39 UTC (rev 18704)
@@ -3,6 +3,8 @@
 
 import org.hibernate.Session;
 import org.hibernate.Transaction;
+import org.hibernate.cfg.AnnotationConfiguration;
+import org.hibernate.cfg.Configuration;
 import org.hibernate.mapping.Column;
 import org.hibernate.test.annotations.TestCase;
 import org.hibernate.test.annotations.id.sequences.entities.Ball;
@@ -305,4 +307,9 @@
 		return new String[] { "org/hibernate/test/annotations/orm.xml" };
 	}
 
+	@Override
+	protected void configure(Configuration cfg) {
+		cfg.setProperty( AnnotationConfiguration.USE_NEW_ID_GENERATOR_MAPPINGS, "true" );
+	}
+
 }

Added: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/NewSchemeIdTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/NewSchemeIdTest.java	                        (rev 0)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/id/sequences/NewSchemeIdTest.java	2010-02-05 18:28:39 UTC (rev 18704)
@@ -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" );
+	}
+}
\ No newline at end of file



More information about the hibernate-commits mailing list