[hibernate-commits] Hibernate SVN: r20296 - in core/trunk/core/src/main/java/org/hibernate: impl and 1 other directories.
hibernate-commits at lists.jboss.org
hibernate-commits at lists.jboss.org
Tue Aug 31 15:07:03 EDT 2010
Author: steve.ebersole at jboss.com
Date: 2010-08-31 15:07:03 -0400 (Tue, 31 Aug 2010)
New Revision: 20296
Modified:
core/trunk/core/src/main/java/org/hibernate/id/UUIDGenerator.java
core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
core/trunk/core/src/main/java/org/hibernate/jmx/SessionFactoryStub.java
Log:
HHH-5517 - Switch uuid generation in SessionFactory to org.hibernate.id.UUIDGenerator instead
Modified: core/trunk/core/src/main/java/org/hibernate/id/UUIDGenerator.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/id/UUIDGenerator.java 2010-08-31 18:57:54 UTC (rev 20295)
+++ core/trunk/core/src/main/java/org/hibernate/id/UUIDGenerator.java 2010-08-31 19:07:03 UTC (rev 20296)
@@ -65,6 +65,13 @@
private UUIDGenerationStrategy strategy;
private UUIDTypeDescriptor.ValueTransformer valueTransformer;
+ public static UUIDGenerator buildSessionFactoryUniqueIdentifierGenerator() {
+ final UUIDGenerator generator = new UUIDGenerator();
+ generator.strategy = StandardRandomStrategy.INSTANCE;
+ generator.valueTransformer = UUIDTypeDescriptor.ToStringTransformer.INSTANCE;
+ return generator;
+ }
+
public void configure(Type type, Properties params, Dialect d) throws MappingException {
// check first for the strategy instance
strategy = (UUIDGenerationStrategy) params.get( UUID_GEN_STRATEGY );
Modified: core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java 2010-08-31 18:57:54 UTC (rev 20295)
+++ core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java 2010-08-31 19:07:03 UTC (rev 20296)
@@ -95,7 +95,7 @@
import org.hibernate.event.EventListeners;
import org.hibernate.exception.SQLExceptionConverter;
import org.hibernate.id.IdentifierGenerator;
-import org.hibernate.id.UUIDHexGenerator;
+import org.hibernate.id.UUIDGenerator;
import org.hibernate.id.factory.IdentifierGeneratorFactory;
import org.hibernate.jdbc.BatcherFactory;
import org.hibernate.mapping.Collection;
@@ -128,7 +128,7 @@
/**
* Concrete implementation of the <tt>SessionFactory</tt> interface. Has the following
- * responsibilites
+ * responsibilities
* <ul>
* <li>caches configuration settings (immutably)
* <li>caches "compiled" mappings ie. <tt>EntityPersister</tt>s and
@@ -152,7 +152,7 @@
public final class SessionFactoryImpl implements SessionFactory, SessionFactoryImplementor {
private static final Logger log = LoggerFactory.getLogger(SessionFactoryImpl.class);
- private static final IdentifierGenerator UUID_GENERATOR = new UUIDHexGenerator();
+ private static final IdentifierGenerator UUID_GENERATOR = UUIDGenerator.buildSessionFactoryUniqueIdentifierGenerator();
private final String name;
private final String uuid;
Modified: core/trunk/core/src/main/java/org/hibernate/jmx/SessionFactoryStub.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/jmx/SessionFactoryStub.java 2010-08-31 18:57:54 UTC (rev 20295)
+++ core/trunk/core/src/main/java/org/hibernate/jmx/SessionFactoryStub.java 2010-08-31 19:07:03 UTC (rev 20296)
@@ -1,4 +1,26 @@
-//$Id: SessionFactoryStub.java 8754 2005-12-05 23:36:59Z steveebersole $
+/*
+ * 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.jmx;
import java.io.InvalidObjectException;
@@ -23,7 +45,7 @@
import org.hibernate.TypeHelper;
import org.hibernate.engine.FilterDefinition;
import org.hibernate.id.IdentifierGenerator;
-import org.hibernate.id.UUIDHexGenerator;
+import org.hibernate.id.UUIDGenerator;
import org.hibernate.impl.SessionFactoryObjectFactory;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.metadata.CollectionMetadata;
@@ -37,11 +59,9 @@
* @author Gavin King
*/
public class SessionFactoryStub implements SessionFactory {
+ private static final IdentifierGenerator UUID_GENERATOR = UUIDGenerator.buildSessionFactoryUniqueIdentifierGenerator();
+ private static final Logger log = LoggerFactory.getLogger( SessionFactoryStub.class );
- private static final Logger log = LoggerFactory.getLogger(SessionFactoryStub.class);
-
- private static final IdentifierGenerator UUID_GENERATOR = new UUIDHexGenerator();
-
private transient SessionFactory impl;
private transient HibernateService service;
private String uuid;
More information about the hibernate-commits
mailing list