HHH-5517 - Switch uuid generation in SessionFactory to org.hibernate.id.UUIDGenerator instead
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@20296 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
21c49fff68
commit
ab97bf0bf0
|
@ -65,6 +65,13 @@ public class UUIDGenerator implements IdentifierGenerator, Configurable {
|
|||
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 );
|
||||
|
|
|
@ -95,7 +95,7 @@ import org.hibernate.engine.query.sql.NativeSQLQuerySpecification;
|
|||
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 @@ import org.hibernate.util.ReflectHelper;
|
|||
|
||||
/**
|
||||
* 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 @@ import org.hibernate.util.ReflectHelper;
|
|||
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;
|
||||
|
|
|
@ -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.Cache;
|
|||
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,10 +59,8 @@ import org.hibernate.stat.Statistics;
|
|||
* @author Gavin King
|
||||
*/
|
||||
public class SessionFactoryStub implements SessionFactory {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SessionFactoryStub.class);
|
||||
|
||||
private static final IdentifierGenerator UUID_GENERATOR = new UUIDHexGenerator();
|
||||
private static final IdentifierGenerator UUID_GENERATOR = UUIDGenerator.buildSessionFactoryUniqueIdentifierGenerator();
|
||||
private static final Logger log = LoggerFactory.getLogger( SessionFactoryStub.class );
|
||||
|
||||
private transient SessionFactory impl;
|
||||
private transient HibernateService service;
|
||||
|
|
Loading…
Reference in New Issue