Hibernate SVN: r19539 - core/branches/Branch_3_3_2_GA_CP/distribution/src/assembly.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-05-18 11:14:20 -0400 (Tue, 18 May 2010)
New Revision: 19539
Modified:
core/branches/Branch_3_3_2_GA_CP/distribution/src/assembly/dist.xml
Log:
JBPAPP-4234 HHH-4548 Alter poms to not use javax.* artifacts under Sun proprietary license
Modified: core/branches/Branch_3_3_2_GA_CP/distribution/src/assembly/dist.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/distribution/src/assembly/dist.xml 2010-05-18 07:59:51 UTC (rev 19538)
+++ core/branches/Branch_3_3_2_GA_CP/distribution/src/assembly/dist.xml 2010-05-18 15:14:20 UTC (rev 19539)
@@ -71,14 +71,6 @@
<destName>hibernate-core.jar</destName>
</file>
<file>
- <source>../jdbc3-testing/target/hibernate-jdbc3-testing-${project.version}.jar</source>
- <destName>hibernate-jdbc3-testing.jar</destName>
- </file>
- <file>
- <source>../jdbc4-testing/target/hibernate-jdbc4-testing-${project.version}.jar</source>
- <destName>hibernate-jdbc4-testing.jar</destName>
- </file>
- <file>
<source>../jmx/target/hibernate-jmx-${project.version}.jar</source>
<destName>hibernate-jmx.jar</destName>
</file>
13 years, 11 months
Hibernate SVN: r19538 - core/trunk/core/src/main/java/org/hibernate/engine/jdbc.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2010-05-18 03:59:51 -0400 (Tue, 18 May 2010)
New Revision: 19538
Modified:
core/trunk/core/src/main/java/org/hibernate/engine/jdbc/JdbcSupportLoader.java
Log:
Minor JavaDoc typo
Modified: core/trunk/core/src/main/java/org/hibernate/engine/jdbc/JdbcSupportLoader.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/engine/jdbc/JdbcSupportLoader.java 2010-05-18 07:14:20 UTC (rev 19537)
+++ core/trunk/core/src/main/java/org/hibernate/engine/jdbc/JdbcSupportLoader.java 2010-05-18 07:59:51 UTC (rev 19538)
@@ -40,7 +40,7 @@
private static final Logger log = LoggerFactory.getLogger( JdbcSupportLoader.class );
/**
- * The public factory method for obtaining the appropriate (accoring to given JDBC {@link java.sql.Connection})
+ * The public factory method for obtaining the appropriate (according to given JDBC {@link java.sql.Connection})
* {@link JdbcSupport}.
*
* @param jdbcConnection A JDBC {@link java.sql.Connection} which can be used to gauge the drivers level of support,
@@ -61,7 +61,7 @@
* but also whether the actual {@link Connection} instance implements them (i.e. can be called without simply
* throwing an exception).
*
- * @param jdbcConnection The connection whcih can be used in level-of-support testing.
+ * @param jdbcConnection The connection which can be used in level-of-support testing.
*
* @return True if the connection can be used to create LOBs; false otherwise.
*/
13 years, 11 months
Hibernate SVN: r19537 - core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2010-05-18 03:14:20 -0400 (Tue, 18 May 2010)
New Revision: 19537
Modified:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/MoreFetchProfileTest.java
Log:
HHH-5233 Add @FailureExpected
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/MoreFetchProfileTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/MoreFetchProfileTest.java 2010-05-18 07:12:45 UTC (rev 19536)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/MoreFetchProfileTest.java 2010-05-18 07:14:20 UTC (rev 19537)
@@ -13,7 +13,7 @@
*/
public class MoreFetchProfileTest extends TestCase{
- //@FailureExpected( jiraKey = "HHH-5233")
+ @FailureExpected( jiraKey = "HHH-5233")
public void testFetchWithTwoOverrides() throws Exception {
Session s = openSession( );
s.enableFetchProfile( "customer-with-orders-and-country" );
13 years, 11 months
Hibernate SVN: r19536 - core/trunk/documentation/manual.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2010-05-18 03:12:45 -0400 (Tue, 18 May 2010)
New Revision: 19536
Modified:
core/trunk/documentation/manual/pom.xml
Log:
HHH-5233 revert incorrect pom.xml change
Modified: core/trunk/documentation/manual/pom.xml
===================================================================
--- core/trunk/documentation/manual/pom.xml 2010-05-18 07:05:32 UTC (rev 19535)
+++ core/trunk/documentation/manual/pom.xml 2010-05-18 07:12:45 UTC (rev 19536)
@@ -40,15 +40,15 @@
<configuration>
<sourceDocumentName>HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.xml</sourceDocumentName>
<masterTranslation>en-US</masterTranslation>
- <!-- translations>
+ <translations>
<translation>de-DE</translation>
<translation>es-ES</translation>
<translation>fr-FR</translation>
<translation>ja-JP</translation>
- <!- - <translation>ko-KR</translation> - ->
+ <!-- <translation>ko-KR</translation> -->
<translation>pt-BR</translation>
<translation>zh-CN</translation>
- </translations -->
+ </translations>
<imageResource>
<directory>${basedir}/src/main/docbook/en-US</directory>
<excludes>
13 years, 11 months
Hibernate SVN: r19535 - in core/trunk: documentation/manual and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: epbernard
Date: 2010-05-18 03:05:32 -0400 (Tue, 18 May 2010)
New Revision: 19535
Modified:
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer.java
core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/MoreFetchProfileTest.java
core/trunk/documentation/manual/pom.xml
Log:
HHH-5233 add test on @FetchProfile and multiple @FetchOverride
Clean some more
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer.java 2010-05-18 06:25:23 UTC (rev 19534)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/Customer.java 2010-05-18 07:05:32 UTC (rev 19535)
@@ -49,7 +49,8 @@
@FetchProfile(name = "customer-with-orders-and-country",
fetchOverrides = {
@FetchProfile.FetchOverride(entity = Customer.class, association = "orders", mode = FetchMode.JOIN),
- @FetchProfile.FetchOverride(entity = Customer.class, association = "lastOrder", mode = FetchMode.JOIN)
+ @FetchProfile.FetchOverride(entity = Customer.class, association = "lastOrder", mode = FetchMode.JOIN),
+ @FetchProfile.FetchOverride(entity = Order.class, association = "country", mode = FetchMode.JOIN)
})
})
public class Customer {
Modified: core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/MoreFetchProfileTest.java
===================================================================
--- core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/MoreFetchProfileTest.java 2010-05-18 06:25:23 UTC (rev 19534)
+++ core/trunk/annotations/src/test/java/org/hibernate/test/annotations/fetchprofile/MoreFetchProfileTest.java 2010-05-18 07:05:32 UTC (rev 19535)
@@ -13,7 +13,7 @@
*/
public class MoreFetchProfileTest extends TestCase{
- @FailureExpected( jiraKey = "HHH-5233")
+ //@FailureExpected( jiraKey = "HHH-5233")
public void testFetchWithTwoOverrides() throws Exception {
Session s = openSession( );
s.enableFetchProfile( "customer-with-orders-and-country" );
@@ -47,7 +47,7 @@
assertTrue( Hibernate.isInitialized( c.getLastOrder() ) );
assertTrue( Hibernate.isInitialized( c.getOrders() ) );
for(Order so : c.getOrders() ) {
- //assertTrue( Hibernate.isInitialized( so.getCountry() ) );
+ assertTrue( Hibernate.isInitialized( so.getCountry() ) );
}
final Order order = c.getOrders().iterator().next();
c.getOrders().remove( order );
Modified: core/trunk/documentation/manual/pom.xml
===================================================================
--- core/trunk/documentation/manual/pom.xml 2010-05-18 06:25:23 UTC (rev 19534)
+++ core/trunk/documentation/manual/pom.xml 2010-05-18 07:05:32 UTC (rev 19535)
@@ -40,15 +40,15 @@
<configuration>
<sourceDocumentName>HIBERNATE_-_Relational_Persistence_for_Idiomatic_Java.xml</sourceDocumentName>
<masterTranslation>en-US</masterTranslation>
- <translations>
+ <!-- translations>
<translation>de-DE</translation>
<translation>es-ES</translation>
<translation>fr-FR</translation>
<translation>ja-JP</translation>
- <!-- <translation>ko-KR</translation> -->
+ <!- - <translation>ko-KR</translation> - ->
<translation>pt-BR</translation>
<translation>zh-CN</translation>
- </translations>
+ </translations -->
<imageResource>
<directory>${basedir}/src/main/docbook/en-US</directory>
<excludes>
13 years, 11 months
Hibernate SVN: r19534 - core/branches/Branch_3_3_2_GA_CP/core.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-05-18 02:25:23 -0400 (Tue, 18 May 2010)
New Revision: 19534
Modified:
core/branches/Branch_3_3_2_GA_CP/core/pom.xml
Log:
JBPAPP-4234 HHH-4548 Alter poms to not use javax.* artifacts under Sun proprietary license
Modified: core/branches/Branch_3_3_2_GA_CP/core/pom.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/pom.xml 2010-05-18 06:13:11 UTC (rev 19533)
+++ core/branches/Branch_3_3_2_GA_CP/core/pom.xml 2010-05-18 06:25:23 UTC (rev 19534)
@@ -51,11 +51,11 @@
<dependency>
<groupId>org.jboss.javaee</groupId>
<artifactId>jboss-jacc-api</artifactId>
- <version>1.1.0.GA</version>
+ <version>1.1.0.GA_SP1</version>
<scope>provided</scope>
<exclusions>
<exclusion>
- <groupId>org.jboss.javaee</groupId>
+ <groupId>jboss.web</groupId>
<artifactId>jboss-servlet-api</artifactId>
</exclusion>
<exclusion>
13 years, 11 months
Hibernate SVN: r19533 - core/branches/Branch_3_3_2_GA_CP/core.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-05-18 02:13:11 -0400 (Tue, 18 May 2010)
New Revision: 19533
Modified:
core/branches/Branch_3_3_2_GA_CP/core/pom.xml
Log:
JBPAPP-4234 HHH-4548 Alter poms to not use javax.* artifacts under Sun proprietary license
Modified: core/branches/Branch_3_3_2_GA_CP/core/pom.xml
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/pom.xml 2010-05-17 16:16:27 UTC (rev 19532)
+++ core/branches/Branch_3_3_2_GA_CP/core/pom.xml 2010-05-18 06:13:11 UTC (rev 19533)
@@ -56,7 +56,7 @@
<exclusions>
<exclusion>
<groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-servlet-api_3.0</artifactId>
+ <artifactId>jboss-servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.logging</groupId>
13 years, 11 months
Hibernate SVN: r19532 - in core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate: bytecode/cglib and 2 other directories.
by hibernate-commits@lists.jboss.org
Author: stliu
Date: 2010-05-17 12:16:27 -0400 (Mon, 17 May 2010)
New Revision: 19532
Modified:
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/bytecode/buildtime/CGLIBInstrumenter.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/bytecode/cglib/BytecodeProviderImpl.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/Environment.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/SettingsFactory.java
core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/context/JTASessionContext.java
Log:
JBPAPP-4330 deprecate cglib as hibernate byte code provider
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/bytecode/buildtime/CGLIBInstrumenter.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/bytecode/buildtime/CGLIBInstrumenter.java 2010-05-17 15:40:29 UTC (rev 19531)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/bytecode/buildtime/CGLIBInstrumenter.java 2010-05-17 16:16:27 UTC (rev 19532)
@@ -37,7 +37,7 @@
/**
* Strategy for performing build-time instrumentation of persistent classes in order to enable
* field-level interception using CGLIB.
- *
+ * @deprecated
* @author Steve Ebersole
* @author Gavin King
*/
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/bytecode/cglib/BytecodeProviderImpl.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/bytecode/cglib/BytecodeProviderImpl.java 2010-05-17 15:40:29 UTC (rev 19531)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/bytecode/cglib/BytecodeProviderImpl.java 2010-05-17 16:16:27 UTC (rev 19532)
@@ -39,7 +39,7 @@
/**
* Bytecode provider implementation for CGLIB.
- *
+ * @deprecated
* @author Steve Ebersole
*/
public class BytecodeProviderImpl implements BytecodeProvider {
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/Environment.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/Environment.java 2010-05-17 15:40:29 UTC (rev 19531)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/Environment.java 2010-05-17 16:16:27 UTC (rev 19532)
@@ -777,6 +777,7 @@
return new org.hibernate.bytecode.javassist.BytecodeProviderImpl();
}
else if ( "cglib".equals( providerName ) ) {
+ log.warn( "CGLIB is now deprecated, and will be removed in the furture" );
return new org.hibernate.bytecode.cglib.BytecodeProviderImpl();
}
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/SettingsFactory.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/SettingsFactory.java 2010-05-17 15:40:29 UTC (rev 19531)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/cfg/SettingsFactory.java 2010-05-17 16:16:27 UTC (rev 19532)
@@ -347,11 +347,12 @@
return new org.hibernate.bytecode.javassist.BytecodeProviderImpl();
}
else if ( "cglib".equals( providerName ) ) {
+ log.warn( "CGLIB is now deprecated, and will be removed in the furture" );
return new org.hibernate.bytecode.cglib.BytecodeProviderImpl();
}
else {
- log.debug( "using cglib as bytecode provider by default" );
- return new org.hibernate.bytecode.cglib.BytecodeProviderImpl();
+ log.debug( "using javassist as bytecode provider by default" );
+ return new org.hibernate.bytecode.javassist.BytecodeProviderImpl();
}
}
Modified: core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/context/JTASessionContext.java
===================================================================
--- core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/context/JTASessionContext.java 2010-05-17 15:40:29 UTC (rev 19531)
+++ core/branches/Branch_3_3_2_GA_CP/core/src/main/java/org/hibernate/context/JTASessionContext.java 2010-05-17 16:16:27 UTC (rev 19532)
@@ -89,7 +89,7 @@
}
if ( !JTAHelper.isInProgress( txn.getStatus() ) ) {
// We could register the session against the transaction even though it is
- // not started, but we'd have no guarentee of ever getting the map
+ // not started, but we'd have no guarantee of ever getting the map
// entries cleaned up (aside from spawning threads).
throw new HibernateException( "Current transaction is not in progress" );
}
13 years, 11 months
Hibernate SVN: r19531 - in core/branches/Branch_3_5/core/src: test/java/org/hibernate and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-05-17 11:40:29 -0400 (Mon, 17 May 2010)
New Revision: 19531
Added:
core/branches/Branch_3_5/core/src/test/java/org/hibernate/TestingDatabaseInfo.java
core/branches/Branch_3_5/core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorNoIncrementTest.java
Modified:
core/branches/Branch_3_5/core/src/main/java/org/hibernate/id/SequenceHiLoGenerator.java
core/branches/Branch_3_5/core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorTest.java
Log:
HHH-5230 - Regresion! @SequenceGenerator with allocationSize=1 fails Other allocationSizes appear to be decremented by 1
Modified: core/branches/Branch_3_5/core/src/main/java/org/hibernate/id/SequenceHiLoGenerator.java
===================================================================
--- core/branches/Branch_3_5/core/src/main/java/org/hibernate/id/SequenceHiLoGenerator.java 2010-05-17 15:39:55 UTC (rev 19530)
+++ core/branches/Branch_3_5/core/src/main/java/org/hibernate/id/SequenceHiLoGenerator.java 2010-05-17 15:40:29 UTC (rev 19531)
@@ -61,10 +61,12 @@
maxLo = PropertiesHelper.getInt( MAX_LO, params, 9 );
- hiloOptimizer = new OptimizerFactory.LegacyHiLoAlgorithmOptimizer(
- getIdentifierType().getReturnedClass(),
- maxLo
- );
+ if ( maxLo >= 1 ) {
+ hiloOptimizer = new OptimizerFactory.LegacyHiLoAlgorithmOptimizer(
+ getIdentifierType().getReturnedClass(),
+ maxLo
+ );
+ }
}
public synchronized Serializable generate(final SessionImplementor session, Object obj) {
Added: core/branches/Branch_3_5/core/src/test/java/org/hibernate/TestingDatabaseInfo.java
===================================================================
--- core/branches/Branch_3_5/core/src/test/java/org/hibernate/TestingDatabaseInfo.java (rev 0)
+++ core/branches/Branch_3_5/core/src/test/java/org/hibernate/TestingDatabaseInfo.java 2010-05-17 15:40:29 UTC (rev 19531)
@@ -0,0 +1,52 @@
+/*
+ * 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;
+
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.dialect.Dialect;
+import org.hibernate.dialect.HSQLDialect;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class TestingDatabaseInfo {
+ public static volatile String DRIVER = "org.hsqldb.jdbcDriver";
+ public static volatile String URL = "jdbc:hsqldb:.";
+ public static volatile String USER = "sa";
+ public static volatile String PASS = "";
+
+ public static final Dialect DIALECT = new HSQLDialect();
+
+ public static Configuration buildBaseConfiguration() {
+ return new Configuration()
+ .setProperty( Environment.DRIVER, DRIVER )
+ .setProperty( Environment.URL, URL )
+ .setProperty( Environment.USER, USER )
+ .setProperty( Environment.PASS, PASS )
+ .setProperty( Environment.DIALECT, DIALECT.getClass().getName() );
+ }
+}
Added: core/branches/Branch_3_5/core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorNoIncrementTest.java
===================================================================
--- core/branches/Branch_3_5/core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorNoIncrementTest.java (rev 0)
+++ core/branches/Branch_3_5/core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorNoIncrementTest.java 2010-05-17 15:40:29 UTC (rev 19531)
@@ -0,0 +1,141 @@
+/*
+ * 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.id;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.hibernate.Hibernate;
+import org.hibernate.Session;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.cfg.NamingStrategy;
+import org.hibernate.cfg.ObjectNameNormalizer;
+import org.hibernate.dialect.Dialect;
+import org.hibernate.dialect.H2Dialect;
+import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.impl.SessionImpl;
+import org.hibernate.jdbc.Work;
+import org.hibernate.mapping.SimpleAuxiliaryDatabaseObject;
+import org.hibernate.TestingDatabaseInfo;
+
+/**
+ * I went back to 3.3 source and grabbed the code/logic as it existed back then and crafted this
+ * unit test so that we can make sure the value keep being generated in the expected manner
+ *
+ * @author Steve Ebersole
+ */
+public class SequenceHiLoGeneratorNoIncrementTest extends TestCase {
+ private static final String TEST_SEQUENCE = "test_sequence";
+
+ private Configuration cfg;
+ private SessionFactoryImplementor sessionFactory;
+ private SequenceHiLoGenerator generator;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ Properties properties = new Properties();
+ properties.setProperty( SequenceGenerator.SEQUENCE, TEST_SEQUENCE );
+ properties.setProperty( SequenceHiLoGenerator.MAX_LO, "0" ); // JPA allocationSize of 1
+ properties.setProperty( SequenceGenerator.PARAMETERS, "start with 1" ); // hsqldb sequences start with 0 by default :?
+ properties.put(
+ PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER,
+ new ObjectNameNormalizer() {
+ protected boolean isUseQuotedIdentifiersGlobally() {
+ return false;
+ }
+
+ protected NamingStrategy getNamingStrategy() {
+ return cfg.getNamingStrategy();
+ }
+ }
+ );
+
+ Dialect dialect = new H2Dialect();
+
+ generator = new SequenceHiLoGenerator();
+ generator.configure( Hibernate.LONG, properties, dialect );
+
+ cfg = TestingDatabaseInfo.buildBaseConfiguration()
+ .setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
+ cfg.addAuxiliaryDatabaseObject(
+ new SimpleAuxiliaryDatabaseObject(
+ generator.sqlCreateStrings( dialect )[0],
+ generator.sqlDropStrings( dialect )[0]
+ )
+ );
+
+ sessionFactory = (SessionFactoryImplementor) cfg.buildSessionFactory();
+ }
+
+ protected void tearDown() throws Exception {
+ if ( sessionFactory != null ) {
+ sessionFactory.close();
+ }
+
+ super.tearDown();
+ }
+
+ public void testHiLoAlgorithm() {
+ SessionImpl session = (SessionImpl) sessionFactory.openSession();
+ session.beginTransaction();
+
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ // initially sequence should be uninitialized
+// we have to assume here since in this branch we are testing with hsqldb which does not allow access to the
+// current sequence value and the optimizer does not yet know the value. On trunk (3.6), against H2, we physically
+// check the sequence value in the database
+
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ // historically the hilo generators skipped the initial block of values;
+ // so the first generated id value is maxlo + 1, here be 4
+ Long generatedValue = (Long) generator.generate( session, null );
+ assertEquals( 1L, generatedValue.longValue() );
+
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ generatedValue = (Long) generator.generate( session, null );
+ assertEquals( 2L, generatedValue.longValue() );
+
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ generatedValue = (Long) generator.generate( session, null );
+ assertEquals( 3L, generatedValue.longValue() );
+
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ generatedValue = (Long) generator.generate( session, null );
+ assertEquals( 4L, generatedValue.longValue() );
+
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ generatedValue = (Long) generator.generate( session, null );
+ assertEquals( 5L, generatedValue.longValue() );
+
+ session.getTransaction().commit();
+ session.close();
+ }
+}
\ No newline at end of file
Modified: core/branches/Branch_3_5/core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorTest.java
===================================================================
--- core/branches/Branch_3_5/core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorTest.java 2010-05-17 15:39:55 UTC (rev 19530)
+++ core/branches/Branch_3_5/core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorTest.java 2010-05-17 15:40:29 UTC (rev 19531)
@@ -28,6 +28,7 @@
import junit.framework.TestCase;
import org.hibernate.Hibernate;
+import org.hibernate.TestingDatabaseInfo;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.cfg.NamingStrategy;
@@ -77,10 +78,7 @@
//noinspection deprecation
generator.configure( Hibernate.LONG, properties, dialect );
- cfg = new Configuration()
- .setProperty( Environment.DRIVER, "org.hsqldb.jdbcDriver" )
- .setProperty( Environment.URL, "jdbc:hsqldb:." )
- .setProperty( Environment.USER, "sa" )
+ cfg = TestingDatabaseInfo.buildBaseConfiguration()
.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
cfg.addAuxiliaryDatabaseObject(
new SimpleAuxiliaryDatabaseObject(
13 years, 11 months
Hibernate SVN: r19530 - in core/trunk/core/src: test/java/org/hibernate and 1 other directories.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2010-05-17 11:39:55 -0400 (Mon, 17 May 2010)
New Revision: 19530
Added:
core/trunk/core/src/test/java/org/hibernate/TestingDatabaseInfo.java
core/trunk/core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorNoIncrementTest.java
Modified:
core/trunk/core/src/main/java/org/hibernate/id/SequenceHiLoGenerator.java
core/trunk/core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorTest.java
Log:
HHH-5230 - Regresion! @SequenceGenerator with allocationSize=1 fails Other allocationSizes appear to be decremented by 1
Modified: core/trunk/core/src/main/java/org/hibernate/id/SequenceHiLoGenerator.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/id/SequenceHiLoGenerator.java 2010-05-17 14:29:28 UTC (rev 19529)
+++ core/trunk/core/src/main/java/org/hibernate/id/SequenceHiLoGenerator.java 2010-05-17 15:39:55 UTC (rev 19530)
@@ -61,10 +61,12 @@
maxLo = PropertiesHelper.getInt( MAX_LO, params, 9 );
- hiloOptimizer = new OptimizerFactory.LegacyHiLoAlgorithmOptimizer(
- getIdentifierType().getReturnedClass(),
- maxLo
- );
+ if ( maxLo >= 1 ) {
+ hiloOptimizer = new OptimizerFactory.LegacyHiLoAlgorithmOptimizer(
+ getIdentifierType().getReturnedClass(),
+ maxLo
+ );
+ }
}
public synchronized Serializable generate(final SessionImplementor session, Object obj) {
Added: core/trunk/core/src/test/java/org/hibernate/TestingDatabaseInfo.java
===================================================================
--- core/trunk/core/src/test/java/org/hibernate/TestingDatabaseInfo.java (rev 0)
+++ core/trunk/core/src/test/java/org/hibernate/TestingDatabaseInfo.java 2010-05-17 15:39:55 UTC (rev 19530)
@@ -0,0 +1,50 @@
+package org.hibernate;/*
+ * 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
+ */
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.dialect.Dialect;
+import org.hibernate.dialect.H2Dialect;
+
+/**
+ * TODO : javadoc
+ *
+ * @author Steve Ebersole
+ */
+public class TestingDatabaseInfo {
+ public static volatile String DRIVER = "org.h2.Driver";
+ public static volatile String URL = "jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1";
+ public static volatile String USER = "sa";
+ public static volatile String PASS = "";
+
+ public static final Dialect DIALECT = new H2Dialect();
+
+ public static Configuration buildBaseConfiguration() {
+ return new Configuration()
+ .setProperty( Environment.DRIVER, DRIVER )
+ .setProperty( Environment.URL, URL )
+ .setProperty( Environment.USER, USER )
+ .setProperty( Environment.PASS, PASS )
+ .setProperty( Environment.DIALECT, DIALECT.getClass().getName() );
+ }
+}
Copied: core/trunk/core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorNoIncrementTest.java (from rev 19470, core/trunk/core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorTest.java)
===================================================================
--- core/trunk/core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorNoIncrementTest.java (rev 0)
+++ core/trunk/core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorNoIncrementTest.java 2010-05-17 15:39:55 UTC (rev 19530)
@@ -0,0 +1,164 @@
+/*
+ * 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.id;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.hibernate.Hibernate;
+import org.hibernate.Session;
+import org.hibernate.cfg.Configuration;
+import org.hibernate.cfg.Environment;
+import org.hibernate.cfg.NamingStrategy;
+import org.hibernate.cfg.ObjectNameNormalizer;
+import org.hibernate.dialect.Dialect;
+import org.hibernate.dialect.H2Dialect;
+import org.hibernate.engine.SessionFactoryImplementor;
+import org.hibernate.impl.SessionImpl;
+import org.hibernate.jdbc.Work;
+import org.hibernate.mapping.SimpleAuxiliaryDatabaseObject;
+import org.hibernate.TestingDatabaseInfo;
+
+/**
+ * I went back to 3.3 source and grabbed the code/logic as it existed back then and crafted this
+ * unit test so that we can make sure the value keep being generated in the expected manner
+ *
+ * @author Steve Ebersole
+ */
+@SuppressWarnings({ "deprecation" })
+public class SequenceHiLoGeneratorNoIncrementTest extends TestCase {
+ private static final String TEST_SEQUENCE = "test_sequence";
+
+ private Configuration cfg;
+ private SessionFactoryImplementor sessionFactory;
+ private SequenceHiLoGenerator generator;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ Properties properties = new Properties();
+ properties.setProperty( SequenceGenerator.SEQUENCE, TEST_SEQUENCE );
+ properties.setProperty( SequenceHiLoGenerator.MAX_LO, "0" ); // JPA allocationSize of 1
+ properties.put(
+ PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER,
+ new ObjectNameNormalizer() {
+ @Override
+ protected boolean isUseQuotedIdentifiersGlobally() {
+ return false;
+ }
+
+ @Override
+ protected NamingStrategy getNamingStrategy() {
+ return cfg.getNamingStrategy();
+ }
+ }
+ );
+
+ Dialect dialect = new H2Dialect();
+
+ generator = new SequenceHiLoGenerator();
+ generator.configure( Hibernate.LONG, properties, dialect );
+
+ cfg = TestingDatabaseInfo.buildBaseConfiguration()
+ .setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
+ cfg.addAuxiliaryDatabaseObject(
+ new SimpleAuxiliaryDatabaseObject(
+ generator.sqlCreateStrings( dialect )[0],
+ generator.sqlDropStrings( dialect )[0]
+ )
+ );
+
+ sessionFactory = (SessionFactoryImplementor) cfg.buildSessionFactory();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ if ( sessionFactory != null ) {
+ sessionFactory.close();
+ }
+
+ super.tearDown();
+ }
+
+ public void testHiLoAlgorithm() {
+ SessionImpl session = (SessionImpl) sessionFactory.openSession();
+ session.beginTransaction();
+
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ // initially sequence should be uninitialized
+ assertEquals( 0L, extractSequenceValue( session ) );
+
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ // historically the hilo generators skipped the initial block of values;
+ // so the first generated id value is maxlo + 1, here be 4
+ Long generatedValue = (Long) generator.generate( session, null );
+ assertEquals( 1L, generatedValue.longValue() );
+ // which should also perform the first read on the sequence which should set it to its "start with" value (1)
+ assertEquals( 1L, extractSequenceValue( session ) );
+
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ generatedValue = (Long) generator.generate( session, null );
+ assertEquals( 2L, generatedValue.longValue() );
+ assertEquals( 2L, extractSequenceValue( session ) );
+
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ generatedValue = (Long) generator.generate( session, null );
+ assertEquals( 3L, generatedValue.longValue() );
+ assertEquals( 3L, extractSequenceValue( session ) );
+
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ generatedValue = (Long) generator.generate( session, null );
+ assertEquals( 4L, generatedValue.longValue() );
+ assertEquals( 4L, extractSequenceValue( session ) );
+
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ generatedValue = (Long) generator.generate( session, null );
+ assertEquals( 5L, generatedValue.longValue() );
+ assertEquals( 5L, extractSequenceValue( session ) );
+
+ session.getTransaction().commit();
+ session.close();
+ }
+
+ private long extractSequenceValue(Session session) {
+ class WorkImpl implements Work {
+ private long value;
+ public void execute(Connection connection) throws SQLException {
+ PreparedStatement query = connection.prepareStatement( "select currval('" + TEST_SEQUENCE + "');" );
+ ResultSet resultSet = query.executeQuery();
+ resultSet.next();
+ value = resultSet.getLong( 1 );
+ }
+ }
+ WorkImpl work = new WorkImpl();
+ session.doWork( work );
+ return work.value;
+ }
+}
\ No newline at end of file
Modified: core/trunk/core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorTest.java
===================================================================
--- core/trunk/core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorTest.java 2010-05-17 14:29:28 UTC (rev 19529)
+++ core/trunk/core/src/test/java/org/hibernate/id/SequenceHiLoGeneratorTest.java 2010-05-17 15:39:55 UTC (rev 19530)
@@ -33,6 +33,7 @@
import org.hibernate.Hibernate;
import org.hibernate.Session;
+import org.hibernate.TestingDatabaseInfo;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
import org.hibernate.cfg.NamingStrategy;
@@ -85,10 +86,7 @@
generator = new SequenceHiLoGenerator();
generator.configure( Hibernate.LONG, properties, dialect );
- cfg = new Configuration()
- .setProperty( Environment.DRIVER, "org.h2.Driver" )
- .setProperty( Environment.URL, "jdbc:h2:mem:db1;DB_CLOSE_DELAY=-1" )
- .setProperty( Environment.USER, "sa" )
+ cfg = TestingDatabaseInfo.buildBaseConfiguration()
.setProperty( Environment.HBM2DDL_AUTO, "create-drop" );
cfg.addAuxiliaryDatabaseObject(
new SimpleAuxiliaryDatabaseObject(
13 years, 11 months