mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-06 19:36:03 +00:00
HHH-6098 - Slight naming changes in regards to new logging classes
This commit is contained in:
parent
a616a83d8e
commit
6504cb6d78
@ -1774,7 +1774,7 @@ hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect</programlisting>
|
||||
|
||||
<!-- Second-level caching -->
|
||||
<attribute name="SecondLevelCacheEnabled">true</attribute>
|
||||
<attribute name="CacheProviderClass">org.hibernate.cache.EhCacheProvider</attribute>
|
||||
<attribute name="CacheProviderClass">org.hibernate.cache.internal.EhCacheProvider</attribute>
|
||||
<attribute name="QueryCacheEnabled">true</attribute>
|
||||
|
||||
<!-- Logging -->
|
||||
|
@ -764,7 +764,7 @@ Customer customer = (Customer) session.get( Customer.class, customerId );
|
||||
<row>
|
||||
<entry>EHCache</entry>
|
||||
|
||||
<entry><literal>org.hibernate.cache.EhCacheProvider</literal></entry>
|
||||
<entry><literal>org.hibernate.cache.internal.EhCacheProvider</literal></entry>
|
||||
|
||||
<entry>memory, disk</entry>
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
||||
*/
|
||||
public class C3P0ConnectionProvider implements ConnectionProvider {
|
||||
|
||||
private static final C3P0Logger LOG = Logger.getMessageLogger(C3P0Logger.class, C3P0ConnectionProvider.class.getName());
|
||||
private static final C3P0MessageLogger LOG = Logger.getMessageLogger(C3P0MessageLogger.class, C3P0ConnectionProvider.class.getName());
|
||||
|
||||
//swaldman 2006-08-28: define c3p0-style configuration parameters for properties with
|
||||
// hibernate-specific overrides to detect and warn about conflicting
|
||||
@ -123,7 +123,7 @@ public void configure(Properties props) throws HibernateException {
|
||||
LOG.connectionProperties(ConfigurationHelper.maskOut(connectionProps, "password"));
|
||||
|
||||
autocommit = ConfigurationHelper.getBoolean( Environment.AUTOCOMMIT, props );
|
||||
LOG.autoCommitMode(autocommit);
|
||||
LOG.autoCommitMode( autocommit );
|
||||
|
||||
if (jdbcDriverClass == null) LOG.jdbcDriverNotSpecified(Environment.DRIVER);
|
||||
else {
|
||||
|
@ -26,18 +26,22 @@
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.sql.SQLException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
|
||||
import org.jboss.logging.Cause;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Defines internationalized messages for this hibernate-c3p0, with IDs ranging from 10001 to 15000 inclusively. New messages must
|
||||
* be added after the last message defined to ensure message codes are unique.
|
||||
* The jboss-logging {@link MessageLogger} for the hibernate-c3p0 module. It reserves message ids ranging from
|
||||
* 10001 to 15000 inclusively.
|
||||
* <p/>
|
||||
* New messages must be added after the last message defined to ensure message codes are unique.
|
||||
*/
|
||||
@MessageLogger( projectCode = "HHH" )
|
||||
public interface C3P0Logger extends HibernateLogger {
|
||||
public interface C3P0MessageLogger extends CoreMessageLogger {
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Both hibernate-style property '%s' and c3p0-style property '%s' have been set in hibernate.properties. "
|
@ -1,9 +1,8 @@
|
||||
header
|
||||
{
|
||||
// $Id: hql-sql.g 10001 2006-06-08 21:08:04Z steve.ebersole@jboss.com $
|
||||
package org.hibernate.hql.antlr;
|
||||
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.jboss.logging.Logger;
|
||||
}
|
||||
|
||||
@ -56,7 +55,7 @@ tokens
|
||||
|
||||
// -- Declarations --
|
||||
{
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, HqlSqlBaseWalker.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, HqlSqlBaseWalker.class.getName());
|
||||
|
||||
private int level = 0;
|
||||
private boolean inSelect = false;
|
||||
|
@ -1,10 +1,10 @@
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2011, 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 Middleware LLC.
|
||||
* 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
|
||||
@ -20,11 +20,13 @@
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
|
||||
/**
|
||||
* Indicates failure of an assertion: a possible bug in Hibernate.
|
||||
*
|
||||
@ -34,7 +36,7 @@ public class AssertionFailure extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, AssertionFailure.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, AssertionFailure.class.getName());
|
||||
|
||||
public AssertionFailure( String s ) {
|
||||
super(s);
|
||||
|
@ -25,6 +25,8 @@
|
||||
package org.hibernate;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
|
||||
/**
|
||||
* Indicates access to unfetched data outside of a session context.
|
||||
* For example, when an uninitialized proxy or collection is accessed
|
||||
@ -36,7 +38,7 @@
|
||||
*/
|
||||
public class LazyInitializationException extends HibernateException {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
LazyInitializationException.class.getName());
|
||||
|
||||
public LazyInitializationException(String msg) {
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.bytecode.buildtime.spi.ClassFilter;
|
||||
import org.hibernate.bytecode.buildtime.spi.FieldFilter;
|
||||
import org.hibernate.bytecode.spi.BytecodeProvider;
|
||||
@ -43,7 +43,7 @@
|
||||
*/
|
||||
public class BytecodeProviderImpl implements BytecodeProvider {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, BytecodeProviderImpl.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, BytecodeProviderImpl.class.getName());
|
||||
|
||||
public ProxyFactoryFactory getProxyFactoryFactory() {
|
||||
return new ProxyFactoryFactoryImpl();
|
||||
|
@ -34,7 +34,7 @@
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.bytecode.buildtime.spi.ClassFilter;
|
||||
import org.hibernate.bytecode.spi.AbstractClassTransformerImpl;
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
*/
|
||||
public class JavassistClassTransformer extends AbstractClassTransformerImpl {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
JavassistClassTransformer.class.getName());
|
||||
|
||||
public JavassistClassTransformer(ClassFilter classFilter, org.hibernate.bytecode.buildtime.spi.FieldFilter fieldFilter) {
|
||||
|
@ -28,10 +28,12 @@
|
||||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NamingException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.internal.util.jndi.JndiHelper;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -42,7 +44,7 @@
|
||||
*/
|
||||
public abstract class AbstractJndiBoundCacheProvider implements CacheProvider {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
AbstractJndiBoundCacheProvider.class.getName());
|
||||
|
||||
private Object cache;
|
||||
|
@ -24,8 +24,10 @@
|
||||
*/
|
||||
package org.hibernate.cache;
|
||||
import java.util.Comparator;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cache.access.SoftLock;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -40,7 +42,7 @@
|
||||
*/
|
||||
public class NonstrictReadWriteCache implements CacheConcurrencyStrategy {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
NonstrictReadWriteCache.class.getName());
|
||||
|
||||
private Cache cache;
|
||||
|
@ -24,8 +24,9 @@
|
||||
*/
|
||||
package org.hibernate.cache;
|
||||
import java.util.Comparator;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cache.access.SoftLock;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -34,7 +35,7 @@
|
||||
*/
|
||||
public class ReadOnlyCache implements CacheConcurrencyStrategy {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, ReadOnlyCache.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, ReadOnlyCache.class.getName());
|
||||
|
||||
private Cache cache;
|
||||
|
||||
|
@ -25,8 +25,10 @@
|
||||
package org.hibernate.cache;
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cache.access.SoftLock;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -47,7 +49,7 @@
|
||||
*/
|
||||
public class ReadWriteCache implements CacheConcurrencyStrategy {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, ReadWriteCache.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, ReadWriteCache.class.getName());
|
||||
|
||||
private Cache cache;
|
||||
private int nextLockId;
|
||||
|
@ -29,7 +29,7 @@
|
||||
import java.util.Set;
|
||||
import javax.persistence.EntityNotFoundException;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.UnresolvableObjectException;
|
||||
import org.hibernate.cfg.Settings;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
@ -48,7 +48,7 @@
|
||||
*/
|
||||
public class StandardQueryCache implements QueryCache {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, StandardQueryCache.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, StandardQueryCache.class.getName());
|
||||
|
||||
private QueryResultsRegion cacheRegion;
|
||||
private UpdateTimestampsCache updateTimestampsCache;
|
||||
|
@ -24,8 +24,10 @@
|
||||
*/
|
||||
package org.hibernate.cache;
|
||||
import java.util.Comparator;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cache.access.SoftLock;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -38,7 +40,7 @@
|
||||
*/
|
||||
public class TransactionalCache implements CacheConcurrencyStrategy {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, TransactionalCache.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, TransactionalCache.class.getName());
|
||||
|
||||
private Cache cache;
|
||||
|
||||
|
@ -27,8 +27,9 @@
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cfg.Settings;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -44,7 +45,7 @@
|
||||
public class UpdateTimestampsCache {
|
||||
|
||||
public static final String REGION_NAME = UpdateTimestampsCache.class.getName();
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
UpdateTimestampsCache.class.getName());
|
||||
|
||||
private ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock();
|
||||
|
@ -1,80 +1,81 @@
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC 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 Middleware LLC.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC 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 Middleware LLC.
|
||||
*
|
||||
* 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.cache.impl.bridge;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.cache.Cache;
|
||||
import org.hibernate.cache.CacheConcurrencyStrategy;
|
||||
import org.hibernate.cache.CacheDataDescription;
|
||||
import org.hibernate.cache.CacheException;
|
||||
import org.hibernate.cache.CollectionRegion;
|
||||
import org.hibernate.cache.NonstrictReadWriteCache;
|
||||
import org.hibernate.cache.OptimisticCache;
|
||||
import org.hibernate.cache.ReadOnlyCache;
|
||||
import org.hibernate.cache.ReadWriteCache;
|
||||
import org.hibernate.cache.TransactionalCache;
|
||||
import org.hibernate.cache.access.AccessType;
|
||||
import org.hibernate.cache.access.CollectionRegionAccessStrategy;
|
||||
import org.hibernate.cfg.Settings;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* Adapter specifically bridging {@link CollectionRegion} to {@link Cache}.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class CollectionRegionAdapter extends BaseTransactionalDataRegionAdapter implements CollectionRegion {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
CollectionRegionAdapter.class.getName());
|
||||
|
||||
public CollectionRegionAdapter(Cache underlyingCache, Settings settings, CacheDataDescription metadata) {
|
||||
super( underlyingCache, settings, metadata );
|
||||
if ( underlyingCache instanceof OptimisticCache ) {
|
||||
( ( OptimisticCache ) underlyingCache ).setSource( new OptimisticCacheSourceAdapter( metadata ) );
|
||||
}
|
||||
}
|
||||
|
||||
public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
|
||||
CacheConcurrencyStrategy ccs;
|
||||
if ( AccessType.READ_ONLY.equals( accessType ) ) {
|
||||
if (metadata.isMutable()) LOG.readOnlyCacheConfiguredForMutableCollection(getName());
|
||||
ccs = new ReadOnlyCache();
|
||||
}
|
||||
else if ( AccessType.READ_WRITE.equals( accessType ) ) {
|
||||
ccs = new ReadWriteCache();
|
||||
}
|
||||
else if ( AccessType.NONSTRICT_READ_WRITE.equals( accessType ) ) {
|
||||
ccs = new NonstrictReadWriteCache();
|
||||
}
|
||||
else if ( AccessType.TRANSACTIONAL.equals( accessType ) ) {
|
||||
ccs = new TransactionalCache();
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException( "unrecognized access strategy type [" + accessType + "]" );
|
||||
}
|
||||
ccs.setCache( underlyingCache );
|
||||
return new CollectionAccessStrategyAdapter( this, ccs, settings );
|
||||
}
|
||||
}
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cache.Cache;
|
||||
import org.hibernate.cache.CacheConcurrencyStrategy;
|
||||
import org.hibernate.cache.CacheDataDescription;
|
||||
import org.hibernate.cache.CacheException;
|
||||
import org.hibernate.cache.CollectionRegion;
|
||||
import org.hibernate.cache.NonstrictReadWriteCache;
|
||||
import org.hibernate.cache.OptimisticCache;
|
||||
import org.hibernate.cache.ReadOnlyCache;
|
||||
import org.hibernate.cache.ReadWriteCache;
|
||||
import org.hibernate.cache.TransactionalCache;
|
||||
import org.hibernate.cache.access.AccessType;
|
||||
import org.hibernate.cache.access.CollectionRegionAccessStrategy;
|
||||
import org.hibernate.cfg.Settings;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* Adapter specifically bridging {@link CollectionRegion} to {@link Cache}.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class CollectionRegionAdapter extends BaseTransactionalDataRegionAdapter implements CollectionRegion {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
CollectionRegionAdapter.class.getName());
|
||||
|
||||
public CollectionRegionAdapter(Cache underlyingCache, Settings settings, CacheDataDescription metadata) {
|
||||
super( underlyingCache, settings, metadata );
|
||||
if ( underlyingCache instanceof OptimisticCache ) {
|
||||
( ( OptimisticCache ) underlyingCache ).setSource( new OptimisticCacheSourceAdapter( metadata ) );
|
||||
}
|
||||
}
|
||||
|
||||
public CollectionRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
|
||||
CacheConcurrencyStrategy ccs;
|
||||
if ( AccessType.READ_ONLY.equals( accessType ) ) {
|
||||
if (metadata.isMutable()) LOG.readOnlyCacheConfiguredForMutableCollection(getName());
|
||||
ccs = new ReadOnlyCache();
|
||||
}
|
||||
else if ( AccessType.READ_WRITE.equals( accessType ) ) {
|
||||
ccs = new ReadWriteCache();
|
||||
}
|
||||
else if ( AccessType.NONSTRICT_READ_WRITE.equals( accessType ) ) {
|
||||
ccs = new NonstrictReadWriteCache();
|
||||
}
|
||||
else if ( AccessType.TRANSACTIONAL.equals( accessType ) ) {
|
||||
ccs = new TransactionalCache();
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException( "unrecognized access strategy type [" + accessType + "]" );
|
||||
}
|
||||
ccs.setCache( underlyingCache );
|
||||
return new CollectionAccessStrategyAdapter( this, ccs, settings );
|
||||
}
|
||||
}
|
||||
|
@ -1,79 +1,80 @@
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC 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 Middleware LLC.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC 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 Middleware LLC.
|
||||
*
|
||||
* 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.cache.impl.bridge;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.cache.Cache;
|
||||
import org.hibernate.cache.CacheConcurrencyStrategy;
|
||||
import org.hibernate.cache.CacheDataDescription;
|
||||
import org.hibernate.cache.CacheException;
|
||||
import org.hibernate.cache.EntityRegion;
|
||||
import org.hibernate.cache.NonstrictReadWriteCache;
|
||||
import org.hibernate.cache.OptimisticCache;
|
||||
import org.hibernate.cache.ReadOnlyCache;
|
||||
import org.hibernate.cache.ReadWriteCache;
|
||||
import org.hibernate.cache.TransactionalCache;
|
||||
import org.hibernate.cache.access.AccessType;
|
||||
import org.hibernate.cache.access.EntityRegionAccessStrategy;
|
||||
import org.hibernate.cfg.Settings;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* Adapter specifically bridging {@link EntityRegion} to {@link Cache}.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class EntityRegionAdapter extends BaseTransactionalDataRegionAdapter implements EntityRegion {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, EntityRegionAdapter.class.getName());
|
||||
|
||||
public EntityRegionAdapter(Cache underlyingCache, Settings settings, CacheDataDescription metadata) {
|
||||
super( underlyingCache, settings, metadata );
|
||||
if ( underlyingCache instanceof OptimisticCache ) {
|
||||
( ( OptimisticCache ) underlyingCache ).setSource( new OptimisticCacheSourceAdapter( metadata ) );
|
||||
}
|
||||
}
|
||||
|
||||
public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
|
||||
CacheConcurrencyStrategy ccs;
|
||||
if ( AccessType.READ_ONLY.equals( accessType ) ) {
|
||||
if (metadata.isMutable()) LOG.readOnlyCacheConfiguredForMutableCollection(getName());
|
||||
ccs = new ReadOnlyCache();
|
||||
}
|
||||
else if ( AccessType.READ_WRITE.equals( accessType ) ) {
|
||||
ccs = new ReadWriteCache();
|
||||
}
|
||||
else if ( AccessType.NONSTRICT_READ_WRITE.equals( accessType ) ) {
|
||||
ccs = new NonstrictReadWriteCache();
|
||||
}
|
||||
else if ( AccessType.TRANSACTIONAL.equals( accessType ) ) {
|
||||
ccs = new TransactionalCache();
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException( "unrecognized access strategy type [" + accessType + "]" );
|
||||
}
|
||||
ccs.setCache( underlyingCache );
|
||||
return new EntityAccessStrategyAdapter( this, ccs, settings );
|
||||
}
|
||||
}
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cache.Cache;
|
||||
import org.hibernate.cache.CacheConcurrencyStrategy;
|
||||
import org.hibernate.cache.CacheDataDescription;
|
||||
import org.hibernate.cache.CacheException;
|
||||
import org.hibernate.cache.EntityRegion;
|
||||
import org.hibernate.cache.NonstrictReadWriteCache;
|
||||
import org.hibernate.cache.OptimisticCache;
|
||||
import org.hibernate.cache.ReadOnlyCache;
|
||||
import org.hibernate.cache.ReadWriteCache;
|
||||
import org.hibernate.cache.TransactionalCache;
|
||||
import org.hibernate.cache.access.AccessType;
|
||||
import org.hibernate.cache.access.EntityRegionAccessStrategy;
|
||||
import org.hibernate.cfg.Settings;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* Adapter specifically bridging {@link EntityRegion} to {@link Cache}.
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class EntityRegionAdapter extends BaseTransactionalDataRegionAdapter implements EntityRegion {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, EntityRegionAdapter.class.getName());
|
||||
|
||||
public EntityRegionAdapter(Cache underlyingCache, Settings settings, CacheDataDescription metadata) {
|
||||
super( underlyingCache, settings, metadata );
|
||||
if ( underlyingCache instanceof OptimisticCache ) {
|
||||
( ( OptimisticCache ) underlyingCache ).setSource( new OptimisticCacheSourceAdapter( metadata ) );
|
||||
}
|
||||
}
|
||||
|
||||
public EntityRegionAccessStrategy buildAccessStrategy(AccessType accessType) throws CacheException {
|
||||
CacheConcurrencyStrategy ccs;
|
||||
if ( AccessType.READ_ONLY.equals( accessType ) ) {
|
||||
if (metadata.isMutable()) LOG.readOnlyCacheConfiguredForMutableCollection(getName());
|
||||
ccs = new ReadOnlyCache();
|
||||
}
|
||||
else if ( AccessType.READ_WRITE.equals( accessType ) ) {
|
||||
ccs = new ReadWriteCache();
|
||||
}
|
||||
else if ( AccessType.NONSTRICT_READ_WRITE.equals( accessType ) ) {
|
||||
ccs = new NonstrictReadWriteCache();
|
||||
}
|
||||
else if ( AccessType.TRANSACTIONAL.equals( accessType ) ) {
|
||||
ccs = new TransactionalCache();
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException( "unrecognized access strategy type [" + accessType + "]" );
|
||||
}
|
||||
ccs.setCache( underlyingCache );
|
||||
return new EntityAccessStrategyAdapter( this, ccs, settings );
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,8 @@
|
||||
package org.hibernate.cache.impl.bridge;
|
||||
|
||||
import java.util.Properties;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cache.CacheDataDescription;
|
||||
import org.hibernate.cache.CacheException;
|
||||
import org.hibernate.cache.CacheProvider;
|
||||
@ -50,7 +51,7 @@
|
||||
public class RegionFactoryCacheProviderBridge implements RegionFactory {
|
||||
public static final String DEF_PROVIDER = NoCacheProvider.class.getName();
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
RegionFactoryCacheProviderBridge.class.getName());
|
||||
|
||||
private CacheProvider cacheProvider;
|
||||
|
@ -82,7 +82,7 @@
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.BatchSize;
|
||||
import org.hibernate.annotations.Cache;
|
||||
@ -182,7 +182,7 @@
|
||||
@SuppressWarnings("unchecked")
|
||||
public final class AnnotationBinder {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, AnnotationBinder.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, AnnotationBinder.class.getName());
|
||||
|
||||
/*
|
||||
* Some design description
|
||||
@ -517,7 +517,7 @@ public static void bindClass(
|
||||
return;
|
||||
}
|
||||
|
||||
LOG.bindingEntityFromClass(clazzToProcess.getName());
|
||||
LOG.bindingEntityFromClass( clazzToProcess.getName() );
|
||||
|
||||
PersistentClass superEntity = getSuperEntity(
|
||||
clazzToProcess, inheritanceStatePerClass, mappings, inheritanceState
|
||||
@ -1234,7 +1234,7 @@ private static void bindFilterDef(FilterDef defAnn, Mappings mappings) {
|
||||
params.put( param.name(), mappings.getTypeResolver().heuristicType( param.type() ) );
|
||||
}
|
||||
FilterDefinition def = new FilterDefinition( defAnn.name(), defAnn.defaultCondition(), params );
|
||||
LOG.bindingFilterDefinition(def.getFilterName());
|
||||
LOG.bindingFilterDefinition( def.getFilterName() );
|
||||
mappings.addFilterDefinition( def );
|
||||
}
|
||||
|
||||
@ -1290,11 +1290,11 @@ private static void bindTypeDef(TypeDef defAnn, Mappings mappings) {
|
||||
}
|
||||
|
||||
if ( !BinderHelper.isEmptyAnnotationValue( defAnn.name() ) ) {
|
||||
LOG.bindingTypeDefinition(defAnn.name());
|
||||
LOG.bindingTypeDefinition( defAnn.name() );
|
||||
mappings.addTypeDef( defAnn.name(), defAnn.typeClass().getName(), params );
|
||||
}
|
||||
if ( !defAnn.defaultForType().equals( void.class ) ) {
|
||||
LOG.bindingTypeDefinition(defAnn.defaultForType().getName());
|
||||
LOG.bindingTypeDefinition( defAnn.defaultForType().getName() );
|
||||
mappings.addTypeDef( defAnn.defaultForType().getName(), defAnn.typeClass().getName(), params );
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
import java.util.StringTokenizer;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.AnyMetaDef;
|
||||
import org.hibernate.annotations.AnyMetaDefs;
|
||||
@ -62,6 +62,7 @@
|
||||
import org.hibernate.mapping.Table;
|
||||
import org.hibernate.mapping.ToOne;
|
||||
import org.hibernate.mapping.Value;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -71,7 +72,7 @@ public class BinderHelper {
|
||||
|
||||
public static final String ANNOTATION_STRING_DEFAULT = "";
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, BinderHelper.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, BinderHelper.class.getName());
|
||||
|
||||
private BinderHelper() {
|
||||
}
|
||||
@ -637,7 +638,7 @@ private static void checkAnyMetaDefValidity(boolean mustHaveName, AnyMetaDef def
|
||||
|
||||
private static void bindAnyMetaDef(AnyMetaDef defAnn, Mappings mappings) {
|
||||
if ( isEmptyAnnotationValue( defAnn.name() ) ) return; //don't map not named definitions
|
||||
LOG.bindingAnyMetaDefinition(defAnn.name());
|
||||
LOG.bindingAnyMetaDefinition( defAnn.name() );
|
||||
mappings.addAnyMetaDef( defAnn );
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,8 @@
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.mapping.Collection;
|
||||
import org.hibernate.mapping.IndexedCollection;
|
||||
@ -41,7 +42,7 @@
|
||||
*/
|
||||
public abstract class CollectionSecondPass implements SecondPass {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, CollectionSecondPass.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, CollectionSecondPass.class.getName());
|
||||
|
||||
Mappings mappings;
|
||||
Collection collection;
|
||||
|
@ -66,7 +66,7 @@
|
||||
import org.hibernate.DuplicateMappingException;
|
||||
import org.hibernate.EmptyInterceptor;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.Interceptor;
|
||||
import org.hibernate.InvalidMappingException;
|
||||
import org.hibernate.MappingException;
|
||||
@ -161,7 +161,7 @@
|
||||
*/
|
||||
public class Configuration implements Serializable {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, Configuration.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Configuration.class.getName());
|
||||
|
||||
/**
|
||||
* Setting used to give the name of the default {@link org.hibernate.annotations.CacheConcurrencyStrategy}
|
||||
@ -526,7 +526,7 @@ public Configuration addCacheableFile(File xmlFile) throws MappingException {
|
||||
LOG.unableToDeserializeCache(cachedFile.getPath(), e);
|
||||
}
|
||||
catch ( FileNotFoundException e ) {
|
||||
LOG.cachedFileNotFound(cachedFile.getPath(), e);
|
||||
LOG.cachedFileNotFound( cachedFile.getPath(), e );
|
||||
}
|
||||
|
||||
final String name = xmlFile.getAbsolutePath();
|
||||
|
@ -1,109 +1,111 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
/*
|
||||
* 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.cfg;
|
||||
|
||||
import java.io.InputStream;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.util.xml.DTDEntityResolver;
|
||||
import org.jboss.logging.Logger;
|
||||
import org.xml.sax.EntityResolver;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
/**
|
||||
* Resolve JPA xsd files locally
|
||||
* Hibernate OGM uses this class, consider this some kind of exposed service at the SPI level
|
||||
*
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class EJB3DTDEntityResolver extends DTDEntityResolver {
|
||||
public static final EntityResolver INSTANCE = new EJB3DTDEntityResolver();
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, EJB3DTDEntityResolver.class.getName());
|
||||
|
||||
boolean resolved = false;
|
||||
|
||||
/**
|
||||
* Persistence.xml has been resolved locally
|
||||
* @return true if it has
|
||||
*/
|
||||
public boolean isResolved() {
|
||||
return resolved;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputSource resolveEntity(String publicId, String systemId) {
|
||||
LOG.trace("Resolving XML entity " + publicId + " : " + systemId);
|
||||
InputSource is = super.resolveEntity( publicId, systemId );
|
||||
if ( is == null ) {
|
||||
if ( systemId != null ) {
|
||||
if ( systemId.endsWith( "orm_1_0.xsd" ) ) {
|
||||
InputStream dtdStream = getStreamFromClasspath( "orm_1_0.xsd" );
|
||||
final InputSource source = buildInputSource( publicId, systemId, dtdStream, false );
|
||||
if (source != null) return source;
|
||||
}
|
||||
else if ( systemId.endsWith( "orm_2_0.xsd" ) ) {
|
||||
InputStream dtdStream = getStreamFromClasspath( "orm_2_0.xsd" );
|
||||
final InputSource source = buildInputSource( publicId, systemId, dtdStream, false );
|
||||
if (source != null) return source;
|
||||
}
|
||||
else if ( systemId.endsWith( "persistence_1_0.xsd" ) ) {
|
||||
InputStream dtdStream = getStreamFromClasspath( "persistence_1_0.xsd" );
|
||||
final InputSource source = buildInputSource( publicId, systemId, dtdStream, true );
|
||||
if (source != null) return source;
|
||||
}
|
||||
else if ( systemId.endsWith( "persistence_2_0.xsd" ) ) {
|
||||
InputStream dtdStream = getStreamFromClasspath( "persistence_2_0.xsd" );
|
||||
final InputSource source = buildInputSource( publicId, systemId, dtdStream, true );
|
||||
if (source != null) return source;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
resolved = true;
|
||||
return is;
|
||||
}
|
||||
//use the default behavior
|
||||
return null;
|
||||
}
|
||||
|
||||
private InputSource buildInputSource(String publicId, String systemId, InputStream dtdStream, boolean resolved) {
|
||||
if ( dtdStream == null ) {
|
||||
LOG.trace("Unable to locate [" + systemId + "] on classpath");
|
||||
return null;
|
||||
}
|
||||
LOG.trace("Located [" + systemId + "] in classpath");
|
||||
InputSource source = new InputSource(dtdStream);
|
||||
source.setPublicId(publicId);
|
||||
source.setSystemId(systemId);
|
||||
this.resolved = resolved;
|
||||
return source;
|
||||
}
|
||||
|
||||
private InputStream getStreamFromClasspath(String fileName) {
|
||||
LOG.trace("Recognized JPA ORM namespace; attempting to resolve on classpath under org/hibernate/ejb");
|
||||
String path = "org/hibernate/ejb/" + fileName;
|
||||
InputStream dtdStream = resolveInHibernateNamespace( path );
|
||||
return dtdStream;
|
||||
}
|
||||
}
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.xml.DTDEntityResolver;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.xml.sax.EntityResolver;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
/**
|
||||
* Resolve JPA xsd files locally
|
||||
* Hibernate OGM uses this class, consider this some kind of exposed service at the SPI level
|
||||
*
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class EJB3DTDEntityResolver extends DTDEntityResolver {
|
||||
public static final EntityResolver INSTANCE = new EJB3DTDEntityResolver();
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, EJB3DTDEntityResolver.class.getName());
|
||||
|
||||
boolean resolved = false;
|
||||
|
||||
/**
|
||||
* Persistence.xml has been resolved locally
|
||||
* @return true if it has
|
||||
*/
|
||||
public boolean isResolved() {
|
||||
return resolved;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputSource resolveEntity(String publicId, String systemId) {
|
||||
LOG.trace("Resolving XML entity " + publicId + " : " + systemId);
|
||||
InputSource is = super.resolveEntity( publicId, systemId );
|
||||
if ( is == null ) {
|
||||
if ( systemId != null ) {
|
||||
if ( systemId.endsWith( "orm_1_0.xsd" ) ) {
|
||||
InputStream dtdStream = getStreamFromClasspath( "orm_1_0.xsd" );
|
||||
final InputSource source = buildInputSource( publicId, systemId, dtdStream, false );
|
||||
if (source != null) return source;
|
||||
}
|
||||
else if ( systemId.endsWith( "orm_2_0.xsd" ) ) {
|
||||
InputStream dtdStream = getStreamFromClasspath( "orm_2_0.xsd" );
|
||||
final InputSource source = buildInputSource( publicId, systemId, dtdStream, false );
|
||||
if (source != null) return source;
|
||||
}
|
||||
else if ( systemId.endsWith( "persistence_1_0.xsd" ) ) {
|
||||
InputStream dtdStream = getStreamFromClasspath( "persistence_1_0.xsd" );
|
||||
final InputSource source = buildInputSource( publicId, systemId, dtdStream, true );
|
||||
if (source != null) return source;
|
||||
}
|
||||
else if ( systemId.endsWith( "persistence_2_0.xsd" ) ) {
|
||||
InputStream dtdStream = getStreamFromClasspath( "persistence_2_0.xsd" );
|
||||
final InputSource source = buildInputSource( publicId, systemId, dtdStream, true );
|
||||
if (source != null) return source;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
resolved = true;
|
||||
return is;
|
||||
}
|
||||
//use the default behavior
|
||||
return null;
|
||||
}
|
||||
|
||||
private InputSource buildInputSource(String publicId, String systemId, InputStream dtdStream, boolean resolved) {
|
||||
if ( dtdStream == null ) {
|
||||
LOG.trace("Unable to locate [" + systemId + "] on classpath");
|
||||
return null;
|
||||
}
|
||||
LOG.trace("Located [" + systemId + "] in classpath");
|
||||
InputSource source = new InputSource(dtdStream);
|
||||
source.setPublicId(publicId);
|
||||
source.setSystemId(systemId);
|
||||
this.resolved = resolved;
|
||||
return source;
|
||||
}
|
||||
|
||||
private InputStream getStreamFromClasspath(String fileName) {
|
||||
LOG.trace("Recognized JPA ORM namespace; attempting to resolve on classpath under org/hibernate/ejb");
|
||||
String path = "org/hibernate/ejb/" + fileName;
|
||||
InputStream dtdStream = resolveInHibernateNamespace( path );
|
||||
return dtdStream;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
import java.util.Map;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.annotations.ColumnTransformer;
|
||||
import org.hibernate.annotations.ColumnTransformers;
|
||||
import org.hibernate.annotations.Index;
|
||||
@ -38,6 +38,7 @@
|
||||
import org.hibernate.mapping.Join;
|
||||
import org.hibernate.mapping.SimpleValue;
|
||||
import org.hibernate.mapping.Table;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -48,7 +49,7 @@
|
||||
*/
|
||||
public class Ejb3Column {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, Ejb3Column.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Ejb3Column.class.getName());
|
||||
|
||||
private Column mappingColumn;
|
||||
private boolean insertable = true;
|
||||
|
@ -33,11 +33,12 @@
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.Version;
|
||||
import org.hibernate.bytecode.spi.BytecodeProvider;
|
||||
import org.hibernate.internal.util.ConfigHelper;
|
||||
import org.hibernate.internal.util.config.ConfigurationHelper;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
|
||||
@ -570,7 +571,7 @@ public final class Environment {
|
||||
private static final Map OBSOLETE_PROPERTIES = new HashMap();
|
||||
private static final Map RENAMED_PROPERTIES = new HashMap();
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, Environment.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Environment.class.getName());
|
||||
|
||||
/**
|
||||
* Issues warnings to the user when any obsolete or renamed property names are used.
|
||||
|
@ -36,7 +36,7 @@
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.engine.ExecuteUpdateResultCheckStyle;
|
||||
import org.hibernate.engine.FilterDefinition;
|
||||
@ -107,7 +107,7 @@
|
||||
*/
|
||||
public final class HbmBinder {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, HbmBinder.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, HbmBinder.class.getName());
|
||||
|
||||
/**
|
||||
* Private constructor to disallow instantiation.
|
||||
|
@ -28,11 +28,13 @@
|
||||
import java.util.Map;
|
||||
import org.dom4j.Attribute;
|
||||
import org.dom4j.Element;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.engine.NamedSQLQueryDefinition;
|
||||
import org.hibernate.engine.ResultSetMappingDefinition;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -40,7 +42,7 @@
|
||||
*/
|
||||
public class NamedSQLQuerySecondPass extends ResultSetMappingBinder implements QuerySecondPass {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
NamedSQLQuerySecondPass.class.getName());
|
||||
|
||||
private Element queryElem;
|
||||
|
@ -38,7 +38,7 @@
|
||||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Transient;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.ManyToAny;
|
||||
import org.hibernate.annotations.Target;
|
||||
@ -46,6 +46,7 @@
|
||||
import org.hibernate.annotations.common.reflection.XClass;
|
||||
import org.hibernate.annotations.common.reflection.XProperty;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -59,7 +60,7 @@ class PropertyContainer {
|
||||
System.setProperty("jboss.i18n.generate-proxies", "true");
|
||||
}
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, PropertyContainer.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, PropertyContainer.class.getName());
|
||||
|
||||
private final AccessType explicitClassDefinedAccessType;
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.MultiTenancyStrategy;
|
||||
import org.hibernate.cache.QueryCacheFactory;
|
||||
import org.hibernate.cache.RegionFactory;
|
||||
@ -44,6 +44,7 @@
|
||||
import org.hibernate.internal.util.config.ConfigurationHelper;
|
||||
import org.hibernate.service.jta.platform.spi.JtaPlatform;
|
||||
import org.hibernate.service.ServiceRegistry;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -55,7 +56,7 @@ public class SettingsFactory implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -1194386144994524825L;
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, SettingsFactory.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, SettingsFactory.class.getName());
|
||||
|
||||
public static final String DEF_CACHE_REG_FACTORY = NoCachingRegionFactory.class.getName();
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
import javax.persistence.OneToMany;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.BatchSize;
|
||||
import org.hibernate.annotations.Cache;
|
||||
@ -109,6 +109,7 @@
|
||||
import org.hibernate.mapping.SimpleValue;
|
||||
import org.hibernate.mapping.SingleTableSubclass;
|
||||
import org.hibernate.mapping.Table;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -119,7 +120,7 @@
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "serial"})
|
||||
public abstract class CollectionBinder {
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, CollectionBinder.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, CollectionBinder.class.getName());
|
||||
|
||||
protected Collection collection;
|
||||
protected String propertyName;
|
||||
|
@ -40,7 +40,7 @@
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.BatchSize;
|
||||
import org.hibernate.annotations.Cache;
|
||||
@ -96,7 +96,7 @@
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class EntityBinder {
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, EntityBinder.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, EntityBinder.class.getName());
|
||||
|
||||
private String name;
|
||||
private XClass annotatedClass;
|
||||
@ -516,7 +516,7 @@ public void bindTable(
|
||||
}
|
||||
|
||||
if ( persistentClass instanceof TableOwner ) {
|
||||
LOG.bindEntityOnTable(persistentClass.getEntityName(), table.getName());
|
||||
LOG.bindEntityOnTable( persistentClass.getEntityName(), table.getName() );
|
||||
( (TableOwner) persistentClass ).setTable( table );
|
||||
}
|
||||
else {
|
||||
@ -746,7 +746,7 @@ else if ( joinTable != null ) {
|
||||
|
||||
//somehow keep joins() for later.
|
||||
//Has to do the work later because it needs persistentClass id!
|
||||
LOG.addingSecondaryTableToEntity(persistentClass.getEntityName(), join.getTable().getName());
|
||||
LOG.addingSecondaryTableToEntity( persistentClass.getEntityName(), join.getTable().getName() );
|
||||
org.hibernate.annotations.Table matchingTable = findMatchingComplimentTableAnnotation( join );
|
||||
if ( matchingTable != null ) {
|
||||
join.setSequentialSelect( FetchMode.JOIN != matchingTable.fetch() );
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
import java.util.Map;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.OrderBy;
|
||||
import org.hibernate.annotations.Sort;
|
||||
@ -55,7 +55,7 @@
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "serial"})
|
||||
public class ListBinder extends CollectionBinder {
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, ListBinder.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, ListBinder.class.getName());
|
||||
|
||||
public ListBinder() {
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
import javax.persistence.EmbeddedId;
|
||||
import javax.persistence.Id;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.annotations.Generated;
|
||||
import org.hibernate.annotations.GenerationTime;
|
||||
import org.hibernate.annotations.Immutable;
|
||||
@ -52,13 +52,14 @@
|
||||
import org.hibernate.mapping.RootClass;
|
||||
import org.hibernate.mapping.SimpleValue;
|
||||
import org.hibernate.mapping.Value;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class PropertyBinder {
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, PropertyBinder.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, PropertyBinder.class.getName());
|
||||
|
||||
private String name;
|
||||
private String returnedClassName;
|
||||
|
@ -34,7 +34,7 @@
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.CacheMode;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.annotations.CacheModeType;
|
||||
import org.hibernate.annotations.FlushModeType;
|
||||
@ -45,6 +45,7 @@
|
||||
import org.hibernate.engine.NamedSQLQueryDefinition;
|
||||
import org.hibernate.engine.query.sql.NativeSQLQueryReturn;
|
||||
import org.hibernate.engine.query.sql.NativeSQLQueryRootReturn;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -53,7 +54,7 @@
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public abstract class QueryBinder {
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, QueryBinder.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, QueryBinder.class.getName());
|
||||
|
||||
public static void bindQuery(NamedQuery queryAnn, Mappings mappings, boolean isDefault) {
|
||||
if ( queryAnn == null ) return;
|
||||
@ -80,7 +81,7 @@ public static void bindQuery(NamedQuery queryAnn, Mappings mappings, boolean isD
|
||||
else {
|
||||
mappings.addQuery( queryAnn.name(), query );
|
||||
}
|
||||
LOG.bindingNamedQuery(queryAnn.name(), queryAnn.query());
|
||||
LOG.bindingNamedQuery( queryAnn.name(), queryAnn.query() );
|
||||
}
|
||||
|
||||
|
||||
@ -141,7 +142,7 @@ else if ( !void.class.equals( queryAnn.resultClass() ) ) {
|
||||
else {
|
||||
mappings.addSQLQuery( queryAnn.name(), query );
|
||||
}
|
||||
LOG.bindingNamedNativeQuery(queryAnn.name(), queryAnn.query());
|
||||
LOG.bindingNamedNativeQuery( queryAnn.name(), queryAnn.query() );
|
||||
}
|
||||
|
||||
public static void bindNativeQuery(org.hibernate.annotations.NamedNativeQuery queryAnn, Mappings mappings) {
|
||||
@ -194,7 +195,7 @@ else if ( !void.class.equals( queryAnn.resultClass() ) ) {
|
||||
throw new NotYetImplementedException( "Pure native scalar queries are not yet supported" );
|
||||
}
|
||||
mappings.addSQLQuery( queryAnn.name(), query );
|
||||
LOG.bindingNamedNativeQuery(queryAnn.name(), queryAnn.query());
|
||||
LOG.bindingNamedNativeQuery( queryAnn.name(), queryAnn.query() );
|
||||
}
|
||||
|
||||
public static void bindQueries(NamedQueries queriesAnn, Mappings mappings, boolean isDefault) {
|
||||
@ -241,7 +242,7 @@ public static void bindQuery(org.hibernate.annotations.NamedQuery queryAnn, Mapp
|
||||
);
|
||||
|
||||
mappings.addQuery( queryAnn.name(), query );
|
||||
LOG.bindingNamedQuery(queryAnn.name(), queryAnn.query());
|
||||
LOG.bindingNamedQuery( queryAnn.name(), queryAnn.query() );
|
||||
}
|
||||
|
||||
private static FlushMode getFlushMode(FlushModeType flushModeType) {
|
||||
|
@ -34,7 +34,8 @@
|
||||
import javax.persistence.EntityResult;
|
||||
import javax.persistence.FieldResult;
|
||||
import javax.persistence.SqlResultSetMapping;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.cfg.BinderHelper;
|
||||
@ -55,7 +56,7 @@
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class ResultsetMappingSecondPass implements QuerySecondPass {
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
ResultsetMappingSecondPass.class.getName());
|
||||
|
||||
private SqlResultSetMapping ann;
|
||||
@ -72,7 +73,7 @@ public void doSecondPass(Map persistentClasses) throws MappingException {
|
||||
//TODO add parameters checkings
|
||||
if ( ann == null ) return;
|
||||
ResultSetMappingDefinition definition = new ResultSetMappingDefinition( ann.name() );
|
||||
LOG.bindingResultSetMapping(definition.getName());
|
||||
LOG.bindingResultSetMapping( definition.getName() );
|
||||
|
||||
int entityAliasIndex = 0;
|
||||
|
||||
|
@ -22,11 +22,12 @@
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.cfg.annotations;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.annotations.OrderBy;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.mapping.Collection;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -35,7 +36,7 @@
|
||||
* @author Matthew Inger
|
||||
*/
|
||||
public class SetBinder extends CollectionBinder {
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, SetBinder.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, SetBinder.class.getName());
|
||||
|
||||
public SetBinder() {
|
||||
}
|
||||
|
@ -37,7 +37,7 @@
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.annotations.Parameter;
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.hibernate.annotations.common.reflection.XClass;
|
||||
@ -63,7 +63,7 @@
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class SimpleValueBinder {
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, SimpleValueBinder.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, SimpleValueBinder.class.getName());
|
||||
|
||||
private String propertyName;
|
||||
private String returnedClassName;
|
||||
|
@ -29,7 +29,7 @@
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.annotations.Index;
|
||||
import org.hibernate.cfg.BinderHelper;
|
||||
import org.hibernate.cfg.Ejb3JoinColumn;
|
||||
@ -51,6 +51,7 @@
|
||||
import org.hibernate.mapping.Table;
|
||||
import org.hibernate.mapping.ToOne;
|
||||
import org.hibernate.mapping.Value;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -61,7 +62,7 @@
|
||||
@SuppressWarnings("unchecked")
|
||||
public class TableBinder {
|
||||
//TODO move it to a getter/setter strategy
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, TableBinder.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, TableBinder.class.getName());
|
||||
|
||||
private String schema;
|
||||
private String catalog;
|
||||
|
@ -118,7 +118,7 @@
|
||||
import org.dom4j.Attribute;
|
||||
import org.dom4j.Element;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.annotations.Cascade;
|
||||
import org.hibernate.annotations.CollectionOfElements;
|
||||
import org.hibernate.annotations.Columns;
|
||||
@ -142,7 +142,7 @@
|
||||
@SuppressWarnings("unchecked")
|
||||
public class JPAOverridenAnnotationReader implements AnnotationReader {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
JPAOverridenAnnotationReader.class.getName());
|
||||
private static final Map<Class, String> annotationToXml;
|
||||
private static final String SCHEMA_VALIDATION = "Activate schema validation for more information";
|
||||
|
@ -1,307 +1,307 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
// $Id$
|
||||
|
||||
package org.hibernate.cfg.annotations.reflection;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.persistence.AccessType;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.Element;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class XMLContext implements Serializable {
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, XMLContext.class.getName());
|
||||
private Default globalDefaults;
|
||||
private Map<String, Element> classOverriding = new HashMap<String, Element>();
|
||||
private Map<String, Default> defaultsOverriding = new HashMap<String, Default>();
|
||||
private List<Element> defaultElements = new ArrayList<Element>();
|
||||
private List<String> defaultEntityListeners = new ArrayList<String>();
|
||||
private boolean hasContext = false;
|
||||
|
||||
/**
|
||||
* @param doc The xml document to add
|
||||
* @return Add a xml document to this context and return the list of added class names.
|
||||
*/
|
||||
@SuppressWarnings( "unchecked" )
|
||||
public List<String> addDocument(Document doc) {
|
||||
hasContext = true;
|
||||
List<String> addedClasses = new ArrayList<String>();
|
||||
Element root = doc.getRootElement();
|
||||
//global defaults
|
||||
Element metadata = root.element( "persistence-unit-metadata" );
|
||||
if ( metadata != null ) {
|
||||
if ( globalDefaults == null ) {
|
||||
globalDefaults = new Default();
|
||||
globalDefaults.setMetadataComplete(
|
||||
metadata.element( "xml-mapping-metadata-complete" ) != null ?
|
||||
Boolean.TRUE :
|
||||
null
|
||||
);
|
||||
Element defaultElement = metadata.element( "persistence-unit-defaults" );
|
||||
if ( defaultElement != null ) {
|
||||
Element unitElement = defaultElement.element( "schema" );
|
||||
globalDefaults.setSchema( unitElement != null ? unitElement.getTextTrim() : null );
|
||||
unitElement = defaultElement.element( "catalog" );
|
||||
globalDefaults.setCatalog( unitElement != null ? unitElement.getTextTrim() : null );
|
||||
unitElement = defaultElement.element( "access" );
|
||||
setAccess( unitElement, globalDefaults );
|
||||
unitElement = defaultElement.element( "cascade-persist" );
|
||||
globalDefaults.setCascadePersist( unitElement != null ? Boolean.TRUE : null );
|
||||
unitElement = defaultElement.element( "delimited-identifiers" );
|
||||
globalDefaults.setDelimitedIdentifiers( unitElement != null ? Boolean.TRUE : null );
|
||||
defaultEntityListeners.addAll( addEntityListenerClasses( defaultElement, null, addedClasses ) );
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG.duplicateMetadata();
|
||||
}
|
||||
}
|
||||
|
||||
//entity mapping default
|
||||
Default entityMappingDefault = new Default();
|
||||
Element unitElement = root.element( "package" );
|
||||
String packageName = unitElement != null ? unitElement.getTextTrim() : null;
|
||||
entityMappingDefault.setPackageName( packageName );
|
||||
unitElement = root.element( "schema" );
|
||||
entityMappingDefault.setSchema( unitElement != null ? unitElement.getTextTrim() : null );
|
||||
unitElement = root.element( "catalog" );
|
||||
entityMappingDefault.setCatalog( unitElement != null ? unitElement.getTextTrim() : null );
|
||||
unitElement = root.element( "access" );
|
||||
setAccess( unitElement, entityMappingDefault );
|
||||
defaultElements.add( root );
|
||||
|
||||
List<Element> entities = root.elements( "entity" );
|
||||
addClass( entities, packageName, entityMappingDefault, addedClasses );
|
||||
|
||||
entities = root.elements( "mapped-superclass" );
|
||||
addClass( entities, packageName, entityMappingDefault, addedClasses );
|
||||
|
||||
entities = root.elements( "embeddable" );
|
||||
addClass( entities, packageName, entityMappingDefault, addedClasses );
|
||||
return addedClasses;
|
||||
}
|
||||
|
||||
private void setAccess(Element unitElement, Default defaultType) {
|
||||
if ( unitElement != null ) {
|
||||
String access = unitElement.getTextTrim();
|
||||
setAccess( access, defaultType );
|
||||
}
|
||||
}
|
||||
|
||||
private void setAccess( String access, Default defaultType) {
|
||||
AccessType type;
|
||||
if ( access != null ) {
|
||||
try {
|
||||
type = AccessType.valueOf( access );
|
||||
}
|
||||
catch ( IllegalArgumentException e ) {
|
||||
throw new AnnotationException( "Invalid access type " + access + " (check your xml configuration)" );
|
||||
}
|
||||
defaultType.setAccess( type );
|
||||
}
|
||||
}
|
||||
|
||||
private void addClass(List<Element> entities, String packageName, Default defaults, List<String> addedClasses) {
|
||||
for (Element element : entities) {
|
||||
String className = buildSafeClassName( element.attributeValue( "class" ), packageName );
|
||||
if ( classOverriding.containsKey( className ) ) {
|
||||
//maybe switch it to warn?
|
||||
throw new IllegalStateException( "Duplicate XML entry for " + className );
|
||||
}
|
||||
addedClasses.add( className );
|
||||
classOverriding.put( className, element );
|
||||
Default localDefault = new Default();
|
||||
localDefault.override( defaults );
|
||||
String metadataCompleteString = element.attributeValue( "metadata-complete" );
|
||||
if ( metadataCompleteString != null ) {
|
||||
localDefault.setMetadataComplete( Boolean.parseBoolean( metadataCompleteString ) );
|
||||
}
|
||||
String access = element.attributeValue( "access" );
|
||||
setAccess( access, localDefault );
|
||||
defaultsOverriding.put( className, localDefault );
|
||||
|
||||
LOG.debugf("Adding XML overriding information for %s", className);
|
||||
addEntityListenerClasses( element, packageName, addedClasses );
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> addEntityListenerClasses(Element element, String packageName, List<String> addedClasses) {
|
||||
List<String> localAddedClasses = new ArrayList<String>();
|
||||
Element listeners = element.element( "entity-listeners" );
|
||||
if ( listeners != null ) {
|
||||
@SuppressWarnings( "unchecked" )
|
||||
List<Element> elements = listeners.elements( "entity-listener" );
|
||||
for (Element listener : elements) {
|
||||
String listenerClassName = buildSafeClassName( listener.attributeValue( "class" ), packageName );
|
||||
if ( classOverriding.containsKey( listenerClassName ) ) {
|
||||
//maybe switch it to warn?
|
||||
if ( "entity-listener".equals( classOverriding.get( listenerClassName ).getName() ) ) {
|
||||
LOG.duplicateListener(listenerClassName);
|
||||
continue;
|
||||
}
|
||||
throw new IllegalStateException("Duplicate XML entry for " + listenerClassName);
|
||||
}
|
||||
localAddedClasses.add( listenerClassName );
|
||||
classOverriding.put( listenerClassName, listener );
|
||||
}
|
||||
}
|
||||
LOG.debugf("Adding XML overriding information for listeners: %s", localAddedClasses);
|
||||
addedClasses.addAll( localAddedClasses );
|
||||
return localAddedClasses;
|
||||
}
|
||||
|
||||
public static String buildSafeClassName(String className, String defaultPackageName) {
|
||||
if ( className.indexOf( '.' ) < 0 && StringHelper.isNotEmpty( defaultPackageName ) ) {
|
||||
className = StringHelper.qualify( defaultPackageName, className );
|
||||
}
|
||||
return className;
|
||||
}
|
||||
|
||||
public static String buildSafeClassName(String className, XMLContext.Default defaults) {
|
||||
return buildSafeClassName( className, defaults.getPackageName() );
|
||||
}
|
||||
|
||||
public Default getDefault(String className) {
|
||||
Default xmlDefault = new Default();
|
||||
xmlDefault.override( globalDefaults );
|
||||
if ( className != null ) {
|
||||
Default entityMappingOverriding = defaultsOverriding.get( className );
|
||||
xmlDefault.override( entityMappingOverriding );
|
||||
}
|
||||
return xmlDefault;
|
||||
}
|
||||
|
||||
public Element getXMLTree(String className ) {
|
||||
return classOverriding.get( className );
|
||||
}
|
||||
|
||||
public List<Element> getAllDocuments() {
|
||||
return defaultElements;
|
||||
}
|
||||
|
||||
public boolean hasContext() {
|
||||
return hasContext;
|
||||
}
|
||||
|
||||
public static class Default implements Serializable {
|
||||
private AccessType access;
|
||||
private String packageName;
|
||||
private String schema;
|
||||
private String catalog;
|
||||
private Boolean metadataComplete;
|
||||
private Boolean cascadePersist;
|
||||
private Boolean delimitedIdentifier;
|
||||
|
||||
public AccessType getAccess() {
|
||||
return access;
|
||||
}
|
||||
|
||||
protected void setAccess(AccessType access) {
|
||||
this.access = access;
|
||||
}
|
||||
|
||||
public String getCatalog() {
|
||||
return catalog;
|
||||
}
|
||||
|
||||
protected void setCatalog(String catalog) {
|
||||
this.catalog = catalog;
|
||||
}
|
||||
|
||||
public String getPackageName() {
|
||||
return packageName;
|
||||
}
|
||||
|
||||
protected void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
public String getSchema() {
|
||||
return schema;
|
||||
}
|
||||
|
||||
protected void setSchema(String schema) {
|
||||
this.schema = schema;
|
||||
}
|
||||
|
||||
public Boolean getMetadataComplete() {
|
||||
return metadataComplete;
|
||||
}
|
||||
|
||||
public boolean canUseJavaAnnotations() {
|
||||
return metadataComplete == null || !metadataComplete;
|
||||
}
|
||||
|
||||
protected void setMetadataComplete(Boolean metadataComplete) {
|
||||
this.metadataComplete = metadataComplete;
|
||||
}
|
||||
|
||||
public Boolean getCascadePersist() {
|
||||
return cascadePersist;
|
||||
}
|
||||
|
||||
void setCascadePersist(Boolean cascadePersist) {
|
||||
this.cascadePersist = cascadePersist;
|
||||
}
|
||||
|
||||
public void override(Default globalDefault) {
|
||||
if ( globalDefault != null ) {
|
||||
if ( globalDefault.getAccess() != null ) access = globalDefault.getAccess();
|
||||
if ( globalDefault.getPackageName() != null ) packageName = globalDefault.getPackageName();
|
||||
if ( globalDefault.getSchema() != null ) schema = globalDefault.getSchema();
|
||||
if ( globalDefault.getCatalog() != null ) catalog = globalDefault.getCatalog();
|
||||
if ( globalDefault.getDelimitedIdentifier() != null ) delimitedIdentifier = globalDefault.getDelimitedIdentifier();
|
||||
if ( globalDefault.getMetadataComplete() != null ) {
|
||||
metadataComplete = globalDefault.getMetadataComplete();
|
||||
}
|
||||
//TODO fix that in stone if cascade-persist is set already?
|
||||
if ( globalDefault.getCascadePersist() != null ) cascadePersist = globalDefault.getCascadePersist();
|
||||
}
|
||||
}
|
||||
|
||||
public void setDelimitedIdentifiers(Boolean delimitedIdentifier) {
|
||||
this.delimitedIdentifier = delimitedIdentifier;
|
||||
}
|
||||
|
||||
public Boolean getDelimitedIdentifier() {
|
||||
return delimitedIdentifier;
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getDefaultEntityListeners() {
|
||||
return defaultEntityListeners;
|
||||
}
|
||||
}
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.persistence.AccessType;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.Element;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
*/
|
||||
public class XMLContext implements Serializable {
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, XMLContext.class.getName());
|
||||
private Default globalDefaults;
|
||||
private Map<String, Element> classOverriding = new HashMap<String, Element>();
|
||||
private Map<String, Default> defaultsOverriding = new HashMap<String, Default>();
|
||||
private List<Element> defaultElements = new ArrayList<Element>();
|
||||
private List<String> defaultEntityListeners = new ArrayList<String>();
|
||||
private boolean hasContext = false;
|
||||
|
||||
/**
|
||||
* @param doc The xml document to add
|
||||
* @return Add a xml document to this context and return the list of added class names.
|
||||
*/
|
||||
@SuppressWarnings( "unchecked" )
|
||||
public List<String> addDocument(Document doc) {
|
||||
hasContext = true;
|
||||
List<String> addedClasses = new ArrayList<String>();
|
||||
Element root = doc.getRootElement();
|
||||
//global defaults
|
||||
Element metadata = root.element( "persistence-unit-metadata" );
|
||||
if ( metadata != null ) {
|
||||
if ( globalDefaults == null ) {
|
||||
globalDefaults = new Default();
|
||||
globalDefaults.setMetadataComplete(
|
||||
metadata.element( "xml-mapping-metadata-complete" ) != null ?
|
||||
Boolean.TRUE :
|
||||
null
|
||||
);
|
||||
Element defaultElement = metadata.element( "persistence-unit-defaults" );
|
||||
if ( defaultElement != null ) {
|
||||
Element unitElement = defaultElement.element( "schema" );
|
||||
globalDefaults.setSchema( unitElement != null ? unitElement.getTextTrim() : null );
|
||||
unitElement = defaultElement.element( "catalog" );
|
||||
globalDefaults.setCatalog( unitElement != null ? unitElement.getTextTrim() : null );
|
||||
unitElement = defaultElement.element( "access" );
|
||||
setAccess( unitElement, globalDefaults );
|
||||
unitElement = defaultElement.element( "cascade-persist" );
|
||||
globalDefaults.setCascadePersist( unitElement != null ? Boolean.TRUE : null );
|
||||
unitElement = defaultElement.element( "delimited-identifiers" );
|
||||
globalDefaults.setDelimitedIdentifiers( unitElement != null ? Boolean.TRUE : null );
|
||||
defaultEntityListeners.addAll( addEntityListenerClasses( defaultElement, null, addedClasses ) );
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG.duplicateMetadata();
|
||||
}
|
||||
}
|
||||
|
||||
//entity mapping default
|
||||
Default entityMappingDefault = new Default();
|
||||
Element unitElement = root.element( "package" );
|
||||
String packageName = unitElement != null ? unitElement.getTextTrim() : null;
|
||||
entityMappingDefault.setPackageName( packageName );
|
||||
unitElement = root.element( "schema" );
|
||||
entityMappingDefault.setSchema( unitElement != null ? unitElement.getTextTrim() : null );
|
||||
unitElement = root.element( "catalog" );
|
||||
entityMappingDefault.setCatalog( unitElement != null ? unitElement.getTextTrim() : null );
|
||||
unitElement = root.element( "access" );
|
||||
setAccess( unitElement, entityMappingDefault );
|
||||
defaultElements.add( root );
|
||||
|
||||
List<Element> entities = root.elements( "entity" );
|
||||
addClass( entities, packageName, entityMappingDefault, addedClasses );
|
||||
|
||||
entities = root.elements( "mapped-superclass" );
|
||||
addClass( entities, packageName, entityMappingDefault, addedClasses );
|
||||
|
||||
entities = root.elements( "embeddable" );
|
||||
addClass( entities, packageName, entityMappingDefault, addedClasses );
|
||||
return addedClasses;
|
||||
}
|
||||
|
||||
private void setAccess(Element unitElement, Default defaultType) {
|
||||
if ( unitElement != null ) {
|
||||
String access = unitElement.getTextTrim();
|
||||
setAccess( access, defaultType );
|
||||
}
|
||||
}
|
||||
|
||||
private void setAccess( String access, Default defaultType) {
|
||||
AccessType type;
|
||||
if ( access != null ) {
|
||||
try {
|
||||
type = AccessType.valueOf( access );
|
||||
}
|
||||
catch ( IllegalArgumentException e ) {
|
||||
throw new AnnotationException( "Invalid access type " + access + " (check your xml configuration)" );
|
||||
}
|
||||
defaultType.setAccess( type );
|
||||
}
|
||||
}
|
||||
|
||||
private void addClass(List<Element> entities, String packageName, Default defaults, List<String> addedClasses) {
|
||||
for (Element element : entities) {
|
||||
String className = buildSafeClassName( element.attributeValue( "class" ), packageName );
|
||||
if ( classOverriding.containsKey( className ) ) {
|
||||
//maybe switch it to warn?
|
||||
throw new IllegalStateException( "Duplicate XML entry for " + className );
|
||||
}
|
||||
addedClasses.add( className );
|
||||
classOverriding.put( className, element );
|
||||
Default localDefault = new Default();
|
||||
localDefault.override( defaults );
|
||||
String metadataCompleteString = element.attributeValue( "metadata-complete" );
|
||||
if ( metadataCompleteString != null ) {
|
||||
localDefault.setMetadataComplete( Boolean.parseBoolean( metadataCompleteString ) );
|
||||
}
|
||||
String access = element.attributeValue( "access" );
|
||||
setAccess( access, localDefault );
|
||||
defaultsOverriding.put( className, localDefault );
|
||||
|
||||
LOG.debugf("Adding XML overriding information for %s", className);
|
||||
addEntityListenerClasses( element, packageName, addedClasses );
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> addEntityListenerClasses(Element element, String packageName, List<String> addedClasses) {
|
||||
List<String> localAddedClasses = new ArrayList<String>();
|
||||
Element listeners = element.element( "entity-listeners" );
|
||||
if ( listeners != null ) {
|
||||
@SuppressWarnings( "unchecked" )
|
||||
List<Element> elements = listeners.elements( "entity-listener" );
|
||||
for (Element listener : elements) {
|
||||
String listenerClassName = buildSafeClassName( listener.attributeValue( "class" ), packageName );
|
||||
if ( classOverriding.containsKey( listenerClassName ) ) {
|
||||
//maybe switch it to warn?
|
||||
if ( "entity-listener".equals( classOverriding.get( listenerClassName ).getName() ) ) {
|
||||
LOG.duplicateListener(listenerClassName);
|
||||
continue;
|
||||
}
|
||||
throw new IllegalStateException("Duplicate XML entry for " + listenerClassName);
|
||||
}
|
||||
localAddedClasses.add( listenerClassName );
|
||||
classOverriding.put( listenerClassName, listener );
|
||||
}
|
||||
}
|
||||
LOG.debugf("Adding XML overriding information for listeners: %s", localAddedClasses);
|
||||
addedClasses.addAll( localAddedClasses );
|
||||
return localAddedClasses;
|
||||
}
|
||||
|
||||
public static String buildSafeClassName(String className, String defaultPackageName) {
|
||||
if ( className.indexOf( '.' ) < 0 && StringHelper.isNotEmpty( defaultPackageName ) ) {
|
||||
className = StringHelper.qualify( defaultPackageName, className );
|
||||
}
|
||||
return className;
|
||||
}
|
||||
|
||||
public static String buildSafeClassName(String className, XMLContext.Default defaults) {
|
||||
return buildSafeClassName( className, defaults.getPackageName() );
|
||||
}
|
||||
|
||||
public Default getDefault(String className) {
|
||||
Default xmlDefault = new Default();
|
||||
xmlDefault.override( globalDefaults );
|
||||
if ( className != null ) {
|
||||
Default entityMappingOverriding = defaultsOverriding.get( className );
|
||||
xmlDefault.override( entityMappingOverriding );
|
||||
}
|
||||
return xmlDefault;
|
||||
}
|
||||
|
||||
public Element getXMLTree(String className ) {
|
||||
return classOverriding.get( className );
|
||||
}
|
||||
|
||||
public List<Element> getAllDocuments() {
|
||||
return defaultElements;
|
||||
}
|
||||
|
||||
public boolean hasContext() {
|
||||
return hasContext;
|
||||
}
|
||||
|
||||
public static class Default implements Serializable {
|
||||
private AccessType access;
|
||||
private String packageName;
|
||||
private String schema;
|
||||
private String catalog;
|
||||
private Boolean metadataComplete;
|
||||
private Boolean cascadePersist;
|
||||
private Boolean delimitedIdentifier;
|
||||
|
||||
public AccessType getAccess() {
|
||||
return access;
|
||||
}
|
||||
|
||||
protected void setAccess(AccessType access) {
|
||||
this.access = access;
|
||||
}
|
||||
|
||||
public String getCatalog() {
|
||||
return catalog;
|
||||
}
|
||||
|
||||
protected void setCatalog(String catalog) {
|
||||
this.catalog = catalog;
|
||||
}
|
||||
|
||||
public String getPackageName() {
|
||||
return packageName;
|
||||
}
|
||||
|
||||
protected void setPackageName(String packageName) {
|
||||
this.packageName = packageName;
|
||||
}
|
||||
|
||||
public String getSchema() {
|
||||
return schema;
|
||||
}
|
||||
|
||||
protected void setSchema(String schema) {
|
||||
this.schema = schema;
|
||||
}
|
||||
|
||||
public Boolean getMetadataComplete() {
|
||||
return metadataComplete;
|
||||
}
|
||||
|
||||
public boolean canUseJavaAnnotations() {
|
||||
return metadataComplete == null || !metadataComplete;
|
||||
}
|
||||
|
||||
protected void setMetadataComplete(Boolean metadataComplete) {
|
||||
this.metadataComplete = metadataComplete;
|
||||
}
|
||||
|
||||
public Boolean getCascadePersist() {
|
||||
return cascadePersist;
|
||||
}
|
||||
|
||||
void setCascadePersist(Boolean cascadePersist) {
|
||||
this.cascadePersist = cascadePersist;
|
||||
}
|
||||
|
||||
public void override(Default globalDefault) {
|
||||
if ( globalDefault != null ) {
|
||||
if ( globalDefault.getAccess() != null ) access = globalDefault.getAccess();
|
||||
if ( globalDefault.getPackageName() != null ) packageName = globalDefault.getPackageName();
|
||||
if ( globalDefault.getSchema() != null ) schema = globalDefault.getSchema();
|
||||
if ( globalDefault.getCatalog() != null ) catalog = globalDefault.getCatalog();
|
||||
if ( globalDefault.getDelimitedIdentifier() != null ) delimitedIdentifier = globalDefault.getDelimitedIdentifier();
|
||||
if ( globalDefault.getMetadataComplete() != null ) {
|
||||
metadataComplete = globalDefault.getMetadataComplete();
|
||||
}
|
||||
//TODO fix that in stone if cascade-persist is set already?
|
||||
if ( globalDefault.getCascadePersist() != null ) cascadePersist = globalDefault.getCascadePersist();
|
||||
}
|
||||
}
|
||||
|
||||
public void setDelimitedIdentifiers(Boolean delimitedIdentifier) {
|
||||
this.delimitedIdentifier = delimitedIdentifier;
|
||||
}
|
||||
|
||||
public Boolean getDelimitedIdentifier() {
|
||||
return delimitedIdentifier;
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getDefaultEntityListeners() {
|
||||
return defaultEntityListeners;
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
import javax.validation.Validator;
|
||||
import javax.validation.ValidatorFactory;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.event.Initializable;
|
||||
@ -44,6 +44,7 @@
|
||||
import org.hibernate.event.PreUpdateEvent;
|
||||
import org.hibernate.event.PreUpdateEventListener;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -56,7 +57,7 @@
|
||||
public class BeanValidationEventListener implements
|
||||
PreInsertEventListener, PreUpdateEventListener, PreDeleteEventListener, Initializable {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
BeanValidationEventListener.class.getName());
|
||||
|
||||
private ValidatorFactory factory;
|
||||
|
@ -33,7 +33,7 @@
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
@ -47,7 +47,7 @@
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class BeanValidationIntegrator implements Integrator {
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, BeanValidationIntegrator.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, BeanValidationIntegrator.class.getName());
|
||||
|
||||
public static final String APPLY_CONSTRAINTS = "hibernate.validator.apply_to_ddl";
|
||||
|
||||
|
@ -47,7 +47,7 @@
|
||||
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.event.EventType;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
@ -65,7 +65,7 @@
|
||||
*/
|
||||
class TypeSafeActivator {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, TypeSafeActivator.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, TypeSafeActivator.class.getName());
|
||||
|
||||
private static final String FACTORY_PROPERTY = "javax.persistence.validation.factory";
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.event.EventType;
|
||||
@ -54,7 +54,7 @@
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class HibernateSearchIntegrator implements Integrator {
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, HibernateSearchIntegrator.class.getName() );
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, HibernateSearchIntegrator.class.getName() );
|
||||
|
||||
public static final String AUTO_REGISTER = "hibernate.search.autoregister_listeners";
|
||||
public static final String LISTENER_CLASS = "org.hibernate.search.event.FullTextIndexEventListener";
|
||||
|
@ -32,7 +32,7 @@
|
||||
import java.util.Iterator;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.loader.CollectionAliases;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
@ -49,7 +49,7 @@
|
||||
public class PersistentArrayHolder extends AbstractPersistentCollection {
|
||||
protected Object array;
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, PersistentArrayHolder.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, PersistentArrayHolder.class.getName());
|
||||
|
||||
//just to help out during the load (ugly, i know)
|
||||
private transient Class elementClass;
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.transaction.internal.jta.JtaStatusHelper;
|
||||
@ -63,7 +63,7 @@
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class JTASessionContext implements CurrentSessionContext {
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, JTASessionContext.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, JTASessionContext.class.getName());
|
||||
|
||||
protected final SessionFactoryImplementor factory;
|
||||
private transient Map currentSessionMap = new Hashtable();
|
||||
|
@ -39,7 +39,7 @@
|
||||
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
@ -76,7 +76,7 @@
|
||||
*/
|
||||
public class ThreadLocalSessionContext implements CurrentSessionContext {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
ThreadLocalSessionContext.class.getName());
|
||||
private static final Class[] SESSION_PROXY_INTERFACES = new Class[] {
|
||||
Session.class,
|
||||
|
@ -24,7 +24,8 @@
|
||||
package org.hibernate.dialect;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.dialect.function.AnsiTrimFunction;
|
||||
import org.hibernate.dialect.function.DerbyConcatFunction;
|
||||
@ -46,7 +47,7 @@
|
||||
@Deprecated
|
||||
public class DerbyDialect extends DB2Dialect {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, DerbyDialect.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, DerbyDialect.class.getName());
|
||||
|
||||
private int driverVersionMajor;
|
||||
private int driverVersionMinor;
|
||||
|
@ -38,7 +38,7 @@
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.MappingException;
|
||||
@ -93,7 +93,7 @@
|
||||
*/
|
||||
public abstract class Dialect {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, Dialect.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Dialect.class.getName());
|
||||
|
||||
public static final String DEFAULT_BATCH_SIZE = "15";
|
||||
public static final String NO_BATCH = "0";
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.function.AvgWithArgumentCastFunction;
|
||||
import org.hibernate.dialect.function.NoArgSQLFunction;
|
||||
@ -44,7 +44,7 @@
|
||||
*/
|
||||
public class H2Dialect extends Dialect {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, H2Dialect.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, H2Dialect.class.getName());
|
||||
|
||||
private final String querySequenceString;
|
||||
|
||||
|
@ -26,7 +26,8 @@
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.StaleObjectStateException;
|
||||
@ -66,7 +67,7 @@
|
||||
*/
|
||||
public class HSQLDialect extends Dialect {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, HSQLDialect.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, HSQLDialect.class.getName());
|
||||
|
||||
/**
|
||||
* version is 18 for 1.8 or 20 for 2.0
|
||||
|
@ -28,7 +28,7 @@
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.function.NoArgSQLFunction;
|
||||
import org.hibernate.dialect.function.NvlFunction;
|
||||
@ -51,7 +51,7 @@
|
||||
@Deprecated
|
||||
public class Oracle9Dialect extends Dialect {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, Oracle9Dialect.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Oracle9Dialect.class.getName());
|
||||
|
||||
public Oracle9Dialect() {
|
||||
super();
|
||||
|
@ -23,7 +23,8 @@
|
||||
*/
|
||||
package org.hibernate.dialect;
|
||||
import java.sql.Types;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.sql.CaseFragment;
|
||||
import org.hibernate.sql.DecodeCaseFragment;
|
||||
import org.hibernate.sql.JoinFragment;
|
||||
@ -39,7 +40,7 @@
|
||||
@Deprecated
|
||||
public class OracleDialect extends Oracle9Dialect {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, OracleDialect.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, OracleDialect.class.getName());
|
||||
|
||||
public OracleDialect() {
|
||||
super();
|
||||
|
@ -23,7 +23,8 @@
|
||||
*/
|
||||
package org.hibernate.dialect;
|
||||
import java.sql.Types;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.dialect.function.NoArgSQLFunction;
|
||||
import org.hibernate.dialect.function.SQLFunctionTemplate;
|
||||
@ -56,7 +57,7 @@
|
||||
*/
|
||||
public class RDMSOS2200Dialect extends Dialect {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, RDMSOS2200Dialect.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, RDMSOS2200Dialect.class.getName());
|
||||
|
||||
public RDMSOS2200Dialect() {
|
||||
super();
|
||||
|
@ -24,8 +24,10 @@
|
||||
package org.hibernate.dialect.function;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -35,7 +37,7 @@
|
||||
*/
|
||||
public class TemplateRenderer {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, TemplateRenderer.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, TemplateRenderer.class.getName());
|
||||
|
||||
private final String template;
|
||||
private final String[] chunks;
|
||||
|
@ -26,7 +26,7 @@
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.PessimisticLockException;
|
||||
@ -52,7 +52,7 @@
|
||||
*/
|
||||
public class PessimisticReadUpdateLockingStrategy implements LockingStrategy {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
PessimisticReadUpdateLockingStrategy.class.getName());
|
||||
|
||||
private final Lockable lockable;
|
||||
|
@ -26,7 +26,7 @@
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.PessimisticLockException;
|
||||
@ -52,7 +52,7 @@
|
||||
*/
|
||||
public class PessimisticWriteUpdateLockingStrategy implements LockingStrategy {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
PessimisticWriteUpdateLockingStrategy.class.getName());
|
||||
|
||||
private final Lockable lockable;
|
||||
|
@ -26,7 +26,7 @@
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.StaleObjectStateException;
|
||||
@ -48,7 +48,7 @@
|
||||
*/
|
||||
public class UpdateLockingStrategy implements LockingStrategy {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, UpdateLockingStrategy.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, UpdateLockingStrategy.class.getName());
|
||||
|
||||
private final Lockable lockable;
|
||||
private final LockMode lockMode;
|
||||
|
@ -23,10 +23,12 @@
|
||||
*/
|
||||
package org.hibernate.dialect.resolver;
|
||||
import java.sql.SQLException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.exception.SQLStateConverter;
|
||||
import org.hibernate.exception.ViolatedConstraintNameExtracter;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -36,7 +38,7 @@
|
||||
*/
|
||||
public class BasicSQLExceptionConverter {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
BasicSQLExceptionConverter.class.getName());
|
||||
public static final BasicSQLExceptionConverter INSTANCE = new BasicSQLExceptionConverter();
|
||||
public static final String MSG = LOG.unableToQueryDatabaseMetadata();
|
||||
|
@ -34,7 +34,7 @@
|
||||
import java.util.Set;
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.action.internal.BulkOperationCleanupAction;
|
||||
import org.hibernate.action.internal.CollectionAction;
|
||||
import org.hibernate.action.internal.CollectionRecreateAction;
|
||||
@ -63,7 +63,7 @@
|
||||
*/
|
||||
public class ActionQueue {
|
||||
|
||||
static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, ActionQueue.class.getName());
|
||||
static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, ActionQueue.class.getName());
|
||||
private static final int INIT_QUEUE_LIST_SIZE = 5;
|
||||
|
||||
private SessionImplementor session;
|
||||
|
@ -30,7 +30,7 @@
|
||||
import java.util.Stack;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.collection.PersistentCollection;
|
||||
import org.hibernate.event.EventSource;
|
||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||
@ -96,7 +96,7 @@ public final class Cascade {
|
||||
*/
|
||||
public static final int BEFORE_MERGE = 0;
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, Cascade.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Cascade.class.getName());
|
||||
|
||||
|
||||
private int cascadeTo;
|
||||
|
@ -27,7 +27,7 @@
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.ReplicationMode;
|
||||
@ -48,7 +48,7 @@
|
||||
*/
|
||||
public abstract class CascadingAction {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, CascadingAction.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, CascadingAction.class.getName());
|
||||
|
||||
|
||||
// the CascadingAction contract ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -30,7 +30,7 @@
|
||||
import java.util.Collection;
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.collection.PersistentCollection;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
@ -45,7 +45,7 @@
|
||||
*/
|
||||
public final class CollectionEntry implements Serializable {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, CollectionEntry.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, CollectionEntry.class.getName());
|
||||
|
||||
//ATTRIBUTES MAINTAINED BETWEEN FLUSH CYCLES
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.collection.PersistentCollection;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
@ -42,7 +42,7 @@
|
||||
*/
|
||||
public final class Collections {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, Collections.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Collections.class.getName());
|
||||
|
||||
private Collections() {}
|
||||
|
||||
|
@ -24,7 +24,9 @@
|
||||
*/
|
||||
package org.hibernate.engine;
|
||||
import java.io.Serializable;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -37,7 +39,7 @@
|
||||
*/
|
||||
public class IdentifierValue {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, IdentifierValue.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, IdentifierValue.class.getName());
|
||||
|
||||
private final Serializable value;
|
||||
|
||||
|
@ -28,7 +28,7 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.type.Type;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
*/
|
||||
public class ParameterBinder {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, ParameterBinder.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, ParameterBinder.class.getName());
|
||||
|
||||
public static interface NamedParameterSource {
|
||||
public int[] getNamedParameterLocations(String name);
|
||||
|
@ -32,7 +32,7 @@
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.ScrollMode;
|
||||
@ -50,7 +50,7 @@
|
||||
*/
|
||||
public final class QueryParameters {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, QueryParameters.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, QueryParameters.class.getName());
|
||||
|
||||
private Type[] positionalParameterTypes;
|
||||
private Object[] positionalParameterValues;
|
||||
|
@ -42,7 +42,7 @@
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.NonUniqueObjectException;
|
||||
@ -77,7 +77,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
||||
|
||||
public static final Object NO_ROW = new MarkerObject( "NO_ROW" );
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
StatefulPersistenceContext.class.getName());
|
||||
private static final int INIT_COLL_SIZE = 8;
|
||||
|
||||
|
@ -30,7 +30,7 @@
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.CacheMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.bytecode.instrumentation.spi.LazyPropertyInitializer;
|
||||
import org.hibernate.cache.CacheKey;
|
||||
@ -58,8 +58,8 @@
|
||||
*/
|
||||
public final class TwoPhaseLoad {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(
|
||||
HibernateLogger.class, TwoPhaseLoad.class.getName()
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(
|
||||
CoreMessageLogger.class, TwoPhaseLoad.class.getName()
|
||||
);
|
||||
|
||||
private TwoPhaseLoad() {}
|
||||
|
@ -23,7 +23,7 @@
|
||||
*
|
||||
*/
|
||||
package org.hibernate.engine;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.id.IdentifierGeneratorHelper;
|
||||
import org.jboss.logging.Logger;
|
||||
@ -38,7 +38,7 @@
|
||||
*/
|
||||
public class VersionValue {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, VersionValue.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, VersionValue.class.getName());
|
||||
|
||||
private final Object value;
|
||||
/**
|
||||
|
@ -23,7 +23,7 @@
|
||||
*
|
||||
*/
|
||||
package org.hibernate.engine;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.type.VersionType;
|
||||
import org.jboss.logging.Logger;
|
||||
@ -57,7 +57,7 @@ public final class Versioning {
|
||||
*/
|
||||
public static final int OPTIMISTIC_LOCK_DIRTY = 1;
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, Versioning.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, Versioning.class.getName());
|
||||
|
||||
/**
|
||||
* Private constructor disallowing instantiation.
|
||||
|
@ -29,8 +29,10 @@
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -42,7 +44,7 @@
|
||||
*/
|
||||
public class ResultSetWrapperProxy implements InvocationHandler {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, ResultSetWrapperProxy.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, ResultSetWrapperProxy.class.getName());
|
||||
private static final Class[] PROXY_INTERFACES = new Class[] { ResultSet.class };
|
||||
private static final SqlExceptionHelper sqlExceptionHelper = new SqlExceptionHelper();
|
||||
|
||||
|
@ -27,13 +27,15 @@
|
||||
import java.sql.SQLException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.engine.jdbc.batch.spi.Batch;
|
||||
import org.hibernate.engine.jdbc.batch.spi.BatchKey;
|
||||
import org.hibernate.engine.jdbc.batch.spi.BatchObserver;
|
||||
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
||||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
||||
import org.hibernate.engine.jdbc.spi.SqlStatementLogger;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -43,7 +45,7 @@
|
||||
*/
|
||||
public abstract class AbstractBatchImpl implements Batch {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, AbstractBatchImpl.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, AbstractBatchImpl.class.getName());
|
||||
|
||||
private final BatchKey key;
|
||||
private final JdbcCoordinator jdbcCoordinator;
|
||||
|
@ -24,7 +24,8 @@
|
||||
package org.hibernate.engine.jdbc.batch.internal;
|
||||
|
||||
import java.util.Map;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.engine.jdbc.batch.spi.Batch;
|
||||
import org.hibernate.engine.jdbc.batch.spi.BatchBuilder;
|
||||
@ -41,7 +42,7 @@
|
||||
*/
|
||||
public class BatchBuilderImpl implements BatchBuilder, Configurable {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, BatchBuilderImpl.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, BatchBuilderImpl.class.getName());
|
||||
|
||||
private int size;
|
||||
|
||||
|
@ -26,9 +26,10 @@
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.engine.jdbc.batch.spi.BatchKey;
|
||||
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -39,7 +40,7 @@
|
||||
*/
|
||||
public class BatchingBatch extends AbstractBatchImpl {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, BatchingBatch.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, BatchingBatch.class.getName());
|
||||
|
||||
// IMPL NOTE : Until HHH-5797 is fixed, there will only be 1 statement in a batch
|
||||
|
||||
|
@ -26,9 +26,11 @@
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.engine.jdbc.batch.spi.BatchKey;
|
||||
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -39,7 +41,7 @@
|
||||
*/
|
||||
public class NonBatchingBatch extends AbstractBatchImpl {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, NonBatchingBatch.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, NonBatchingBatch.class.getName());
|
||||
|
||||
protected NonBatchingBatch(BatchKey key, JdbcCoordinator jdbcCoordinator) {
|
||||
super( key, jdbcCoordinator );
|
||||
|
@ -29,7 +29,7 @@
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.jdbc.batch.spi.Batch;
|
||||
import org.hibernate.engine.jdbc.batch.spi.BatchBuilder;
|
||||
@ -56,7 +56,7 @@
|
||||
*/
|
||||
public class JdbcCoordinatorImpl implements JdbcCoordinator {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, JdbcCoordinatorImpl.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, JdbcCoordinatorImpl.class.getName());
|
||||
|
||||
private transient TransactionCoordinatorImpl transactionCoordinator;
|
||||
|
||||
|
@ -31,11 +31,12 @@
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.engine.jdbc.spi.InvalidatableWrapper;
|
||||
import org.hibernate.engine.jdbc.spi.JdbcResourceRegistry;
|
||||
import org.hibernate.engine.jdbc.spi.JdbcWrapper;
|
||||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.jboss.logging.Logger.Level;
|
||||
|
||||
@ -46,7 +47,7 @@
|
||||
*/
|
||||
public class JdbcResourceRegistryImpl implements JdbcResourceRegistry {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
JdbcResourceRegistryImpl.class.getName());
|
||||
|
||||
private final HashMap<Statement,Set<ResultSet>> xref = new HashMap<Statement,Set<ResultSet>>();
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.MultiTenancyStrategy;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
@ -64,7 +64,7 @@
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class JdbcServicesImpl implements JdbcServices, ServiceRegistryAwareService, Configurable {
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, JdbcServicesImpl.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, JdbcServicesImpl.class.getName());
|
||||
|
||||
private ServiceRegistryImplementor serviceRegistry;
|
||||
|
||||
|
@ -28,13 +28,15 @@
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.engine.jdbc.ContextualLobCreator;
|
||||
import org.hibernate.engine.jdbc.LobCreationContext;
|
||||
import org.hibernate.engine.jdbc.LobCreator;
|
||||
import org.hibernate.engine.jdbc.NonContextualLobCreator;
|
||||
import org.hibernate.internal.util.config.ConfigurationHelper;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -44,7 +46,7 @@
|
||||
*/
|
||||
public class LobCreatorBuilder {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, LobCreatorBuilder.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, LobCreatorBuilder.class.getName());
|
||||
|
||||
private boolean useContextualLobCreation;
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
import java.util.List;
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.engine.jdbc.internal.proxy.ProxyBuilder;
|
||||
import org.hibernate.engine.jdbc.spi.ConnectionObserver;
|
||||
@ -44,6 +44,7 @@
|
||||
import org.hibernate.engine.jdbc.spi.NonDurableConnectionObserver;
|
||||
import org.hibernate.engine.transaction.spi.TransactionContext;
|
||||
import org.hibernate.internal.util.collections.CollectionHelper;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -55,7 +56,7 @@
|
||||
*/
|
||||
public class LogicalConnectionImpl implements LogicalConnectionImplementor {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, LogicalConnectionImpl.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, LogicalConnectionImpl.class.getName());
|
||||
|
||||
private transient Connection physicalConnection;
|
||||
private transient Connection shareableConnectionProxy;
|
||||
|
@ -27,8 +27,10 @@
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.LinkedHashSet;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -38,7 +40,7 @@
|
||||
*/
|
||||
public class TypeInfoExtracter {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, TypeInfoExtracter.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, TypeInfoExtracter.class.getName());
|
||||
|
||||
private TypeInfoExtracter() {
|
||||
}
|
||||
|
@ -27,9 +27,11 @@
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.engine.jdbc.spi.JdbcResourceRegistry;
|
||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -39,7 +41,7 @@
|
||||
*/
|
||||
public abstract class AbstractResultSetProxyHandler extends AbstractProxyHandler {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
AbstractResultSetProxyHandler.class.getName());
|
||||
|
||||
private ResultSet resultSet;
|
||||
|
@ -28,10 +28,12 @@
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.engine.jdbc.spi.JdbcResourceRegistry;
|
||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||
import org.hibernate.engine.jdbc.spi.LogicalConnectionImplementor;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -41,7 +43,7 @@
|
||||
*/
|
||||
public abstract class AbstractStatementProxyHandler extends AbstractProxyHandler {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
AbstractStatementProxyHandler.class.getName());
|
||||
|
||||
private ConnectionProxyHandler connectionProxyHandler;
|
||||
|
@ -32,11 +32,12 @@
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.engine.jdbc.spi.JdbcResourceRegistry;
|
||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||
import org.hibernate.engine.jdbc.spi.LogicalConnectionImplementor;
|
||||
import org.hibernate.engine.jdbc.spi.NonDurableConnectionObserver;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -48,7 +49,7 @@ public class ConnectionProxyHandler
|
||||
extends AbstractProxyHandler
|
||||
implements InvocationHandler, NonDurableConnectionObserver {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
ConnectionProxyHandler.class.getName());
|
||||
|
||||
private LogicalConnectionImplementor logicalConnection;
|
||||
|
@ -26,7 +26,9 @@
|
||||
import java.sql.Connection;
|
||||
import java.sql.Statement;
|
||||
import java.util.Arrays;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -36,7 +38,7 @@
|
||||
*/
|
||||
public class PreparedStatementProxyHandler extends AbstractStatementProxyHandler {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
PreparedStatementProxyHandler.class.getName());
|
||||
|
||||
private final String sql;
|
||||
|
@ -28,7 +28,7 @@
|
||||
import java.sql.SQLWarning;
|
||||
import java.sql.Statement;
|
||||
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.exception.SQLExceptionConverter;
|
||||
import org.hibernate.exception.SQLStateConverter;
|
||||
@ -44,7 +44,7 @@
|
||||
*/
|
||||
public class SqlExceptionHelper {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, SqlExceptionHelper.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, SqlExceptionHelper.class.getName());
|
||||
|
||||
public static final String DEFAULT_EXCEPTION_MSG = "SQL Exception";
|
||||
public static final String DEFAULT_WARNING_MSG = "SQL Warning";
|
||||
|
@ -23,9 +23,10 @@
|
||||
*/
|
||||
package org.hibernate.engine.jdbc.spi;
|
||||
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.engine.jdbc.internal.FormatStyle;
|
||||
import org.hibernate.engine.jdbc.internal.Formatter;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -35,7 +36,7 @@
|
||||
*/
|
||||
public class SqlStatementLogger {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, SqlStatementLogger.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, SqlStatementLogger.class.getName());
|
||||
|
||||
private boolean logToStdout;
|
||||
private boolean format;
|
||||
|
@ -36,7 +36,7 @@
|
||||
import org.hibernate.CacheMode;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cache.CacheKey;
|
||||
import org.hibernate.cache.entry.CollectionCacheEntry;
|
||||
import org.hibernate.collection.PersistentCollection;
|
||||
@ -60,7 +60,7 @@
|
||||
*/
|
||||
public class CollectionLoadContext {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, CollectionLoadContext.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, CollectionLoadContext.class.getName());
|
||||
|
||||
private final LoadContexts loadContexts;
|
||||
private final ResultSet resultSet;
|
||||
|
@ -1,60 +1,62 @@
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC 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 Middleware LLC.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC 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 Middleware LLC.
|
||||
*
|
||||
* 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.engine.loading;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class EntityLoadContext {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, EntityLoadContext.class.getName());
|
||||
|
||||
private final LoadContexts loadContexts;
|
||||
private final ResultSet resultSet;
|
||||
private final List hydratingEntities = new ArrayList( 20 ); // todo : need map? the prob is a proper key, right?
|
||||
|
||||
public EntityLoadContext(LoadContexts loadContexts, ResultSet resultSet) {
|
||||
this.loadContexts = loadContexts;
|
||||
this.resultSet = resultSet;
|
||||
}
|
||||
|
||||
void cleanup() {
|
||||
if (!hydratingEntities.isEmpty()) LOG.hydratingEntitiesCount(hydratingEntities.size());
|
||||
hydratingEntities.clear();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "<rs=" + resultSet + ">";
|
||||
}
|
||||
}
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class EntityLoadContext {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, EntityLoadContext.class.getName());
|
||||
|
||||
private final LoadContexts loadContexts;
|
||||
private final ResultSet resultSet;
|
||||
private final List hydratingEntities = new ArrayList( 20 ); // todo : need map? the prob is a proper key, right?
|
||||
|
||||
public EntityLoadContext(LoadContexts loadContexts, ResultSet resultSet) {
|
||||
this.loadContexts = loadContexts;
|
||||
this.resultSet = resultSet;
|
||||
}
|
||||
|
||||
void cleanup() {
|
||||
if (!hydratingEntities.isEmpty()) LOG.hydratingEntitiesCount(hydratingEntities.size());
|
||||
hydratingEntities.clear();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + "<rs=" + resultSet + ">";
|
||||
}
|
||||
}
|
||||
|
@ -1,309 +1,310 @@
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC 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 Middleware LLC.
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC 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 Middleware LLC.
|
||||
*
|
||||
* 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.engine.loading;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.collection.PersistentCollection;
|
||||
import org.hibernate.engine.CollectionKey;
|
||||
import org.hibernate.engine.PersistenceContext;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.internal.util.collections.IdentityMap;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* Maps {@link ResultSet result-sets} to specific contextual data
|
||||
* related to processing that {@link ResultSet result-sets}.
|
||||
* <p/>
|
||||
* Implementation note: internally an {@link IdentityMap} is used to maintain
|
||||
* the mappings; {@link IdentityMap} was chosen because I'd rather not be
|
||||
* dependent upon potentially bad {@link ResultSet#equals} and {ResultSet#hashCode}
|
||||
* implementations.
|
||||
* <p/>
|
||||
* Considering the JDBC-redesign work, would further like this contextual info
|
||||
* not mapped seperately, but available based on the result set being processed.
|
||||
* This would also allow maintaining a single mapping as we could reliably get
|
||||
* notification of the result-set closing...
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class LoadContexts {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, LoadContexts.class.getName());
|
||||
|
||||
private final PersistenceContext persistenceContext;
|
||||
private Map collectionLoadContexts;
|
||||
private Map entityLoadContexts;
|
||||
|
||||
private Map xrefLoadingCollectionEntries;
|
||||
|
||||
/**
|
||||
* Creates and binds this to the given persistence context.
|
||||
*
|
||||
* @param persistenceContext The persistence context to which this
|
||||
* will be bound.
|
||||
*/
|
||||
public LoadContexts(PersistenceContext persistenceContext) {
|
||||
this.persistenceContext = persistenceContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the persistence context to which this is bound.
|
||||
*
|
||||
* @return The persistence context to which this is bound.
|
||||
*/
|
||||
public PersistenceContext getPersistenceContext() {
|
||||
return persistenceContext;
|
||||
}
|
||||
|
||||
private SessionImplementor getSession() {
|
||||
return getPersistenceContext().getSession();
|
||||
}
|
||||
|
||||
private EntityMode getEntityMode() {
|
||||
return getSession().getEntityMode();
|
||||
}
|
||||
|
||||
|
||||
// cleanup code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
/**
|
||||
* Release internal state associated with the given result set.
|
||||
* <p/>
|
||||
* This should be called when we are done with processing said result set,
|
||||
* ideally as the result set is being closed.
|
||||
*
|
||||
* @param resultSet The result set for which it is ok to release
|
||||
* associated resources.
|
||||
*/
|
||||
public void cleanup(ResultSet resultSet) {
|
||||
if ( collectionLoadContexts != null ) {
|
||||
CollectionLoadContext collectionLoadContext = ( CollectionLoadContext ) collectionLoadContexts.remove( resultSet );
|
||||
collectionLoadContext.cleanup();
|
||||
}
|
||||
if ( entityLoadContexts != null ) {
|
||||
EntityLoadContext entityLoadContext = ( EntityLoadContext ) entityLoadContexts.remove( resultSet );
|
||||
entityLoadContext.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Release internal state associated with *all* result sets.
|
||||
* <p/>
|
||||
* This is intended as a "failsafe" process to make sure we get everything
|
||||
* cleaned up and released.
|
||||
*/
|
||||
public void cleanup() {
|
||||
if ( collectionLoadContexts != null ) {
|
||||
Iterator itr = collectionLoadContexts.values().iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
CollectionLoadContext collectionLoadContext = ( CollectionLoadContext ) itr.next();
|
||||
LOG.failSafeCollectionsCleanup(collectionLoadContext);
|
||||
collectionLoadContext.cleanup();
|
||||
}
|
||||
collectionLoadContexts.clear();
|
||||
}
|
||||
if ( entityLoadContexts != null ) {
|
||||
Iterator itr = entityLoadContexts.values().iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
EntityLoadContext entityLoadContext = ( EntityLoadContext ) itr.next();
|
||||
LOG.failSafeEntitiesCleanup(entityLoadContext);
|
||||
entityLoadContext.cleanup();
|
||||
}
|
||||
entityLoadContexts.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Collection load contexts ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
/**
|
||||
* Do we currently have any internal entries corresponding to loading
|
||||
* collections?
|
||||
*
|
||||
* @return True if we currently hold state pertaining to loading collections;
|
||||
* false otherwise.
|
||||
*/
|
||||
public boolean hasLoadingCollectionEntries() {
|
||||
return ( collectionLoadContexts != null && !collectionLoadContexts.isEmpty() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Do we currently have any registered internal entries corresponding to loading
|
||||
* collections?
|
||||
*
|
||||
* @return True if we currently hold state pertaining to a registered loading collections;
|
||||
* false otherwise.
|
||||
*/
|
||||
public boolean hasRegisteredLoadingCollectionEntries() {
|
||||
return ( xrefLoadingCollectionEntries != null && !xrefLoadingCollectionEntries.isEmpty() );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the {@link CollectionLoadContext} associated with the given
|
||||
* {@link ResultSet}, creating one if needed.
|
||||
*
|
||||
* @param resultSet The result set for which to retrieve the context.
|
||||
* @return The processing context.
|
||||
*/
|
||||
public CollectionLoadContext getCollectionLoadContext(ResultSet resultSet) {
|
||||
CollectionLoadContext context = null;
|
||||
if (collectionLoadContexts == null) collectionLoadContexts = IdentityMap.instantiate(8);
|
||||
else context = (CollectionLoadContext)collectionLoadContexts.get(resultSet);
|
||||
if ( context == null ) {
|
||||
LOG.trace("Constructing collection load context for result set [" + resultSet + "]");
|
||||
context = new CollectionLoadContext( this, resultSet );
|
||||
collectionLoadContexts.put( resultSet, context );
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to locate the loading collection given the owner's key. The lookup here
|
||||
* occurs against all result-set contexts...
|
||||
*
|
||||
* @param persister The collection persister
|
||||
* @param ownerKey The owner key
|
||||
* @return The loading collection, or null if not found.
|
||||
*/
|
||||
public PersistentCollection locateLoadingCollection(CollectionPersister persister, Serializable ownerKey) {
|
||||
LoadingCollectionEntry lce = locateLoadingCollectionEntry( new CollectionKey( persister, ownerKey, getEntityMode() ) );
|
||||
if ( lce != null ) {
|
||||
if (LOG.isTraceEnabled()) LOG.trace("Returning loading collection: "
|
||||
+ MessageHelper.collectionInfoString(persister, ownerKey, getSession().getFactory()));
|
||||
return lce.getCollection();
|
||||
}
|
||||
// TODO : should really move this log statement to CollectionType, where this is used from...
|
||||
if (LOG.isTraceEnabled()) LOG.trace("Creating collection wrapper: "
|
||||
+ MessageHelper.collectionInfoString(persister, ownerKey, getSession().getFactory()));
|
||||
return null;
|
||||
}
|
||||
|
||||
// loading collection xrefs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
/**
|
||||
* Register a loading collection xref.
|
||||
* <p/>
|
||||
* This xref map is used because sometimes a collection is in process of
|
||||
* being loaded from one result set, but needs to be accessed from the
|
||||
* context of another "nested" result set processing.
|
||||
* <p/>
|
||||
* Implementation note: package protected, as this is meant solely for use
|
||||
* by {@link CollectionLoadContext} to be able to locate collections
|
||||
* being loaded by other {@link CollectionLoadContext}s/{@link ResultSet}s.
|
||||
*
|
||||
* @param entryKey The xref collection key
|
||||
* @param entry The corresponding loading collection entry
|
||||
*/
|
||||
void registerLoadingCollectionXRef(CollectionKey entryKey, LoadingCollectionEntry entry) {
|
||||
if ( xrefLoadingCollectionEntries == null ) {
|
||||
xrefLoadingCollectionEntries = new HashMap();
|
||||
}
|
||||
xrefLoadingCollectionEntries.put( entryKey, entry );
|
||||
}
|
||||
|
||||
/**
|
||||
* The inverse of {@link #registerLoadingCollectionXRef}. Here, we are done
|
||||
* processing the said collection entry, so we remove it from the
|
||||
* load context.
|
||||
* <p/>
|
||||
* The idea here is that other loading collections can now reference said
|
||||
* collection directly from the {@link PersistenceContext} because it
|
||||
* has completed its load cycle.
|
||||
* <p/>
|
||||
* Implementation note: package protected, as this is meant solely for use
|
||||
* by {@link CollectionLoadContext} to be able to locate collections
|
||||
* being loaded by other {@link CollectionLoadContext}s/{@link ResultSet}s.
|
||||
*
|
||||
* @param key The key of the collection we are done processing.
|
||||
*/
|
||||
void unregisterLoadingCollectionXRef(CollectionKey key) {
|
||||
if ( !hasRegisteredLoadingCollectionEntries() ) {
|
||||
return;
|
||||
}
|
||||
xrefLoadingCollectionEntries.remove(key);
|
||||
}
|
||||
|
||||
/*package*/Map getLoadingCollectionXRefs() {
|
||||
return xrefLoadingCollectionEntries;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Locate the LoadingCollectionEntry within *any* of the tracked
|
||||
* {@link CollectionLoadContext}s.
|
||||
* <p/>
|
||||
* Implementation note: package protected, as this is meant solely for use
|
||||
* by {@link CollectionLoadContext} to be able to locate collections
|
||||
* being loaded by other {@link CollectionLoadContext}s/{@link ResultSet}s.
|
||||
*
|
||||
* @param key The collection key.
|
||||
* @return The located entry; or null.
|
||||
*/
|
||||
LoadingCollectionEntry locateLoadingCollectionEntry(CollectionKey key) {
|
||||
if (xrefLoadingCollectionEntries == null) return null;
|
||||
LOG.trace("Attempting to locate loading collection entry [" + key + "] in any result-set context");
|
||||
LoadingCollectionEntry rtn = ( LoadingCollectionEntry ) xrefLoadingCollectionEntries.get( key );
|
||||
if (rtn == null) LOG.trace("Collection [" + key + "] not located in load context");
|
||||
else LOG.trace("Collection [" + key + "] located in load context");
|
||||
return rtn;
|
||||
}
|
||||
|
||||
/*package*/void cleanupCollectionXRefs(Set entryKeys) {
|
||||
Iterator itr = entryKeys.iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
final CollectionKey entryKey = ( CollectionKey ) itr.next();
|
||||
xrefLoadingCollectionEntries.remove( entryKey );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Entity load contexts ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// * currently, not yet used...
|
||||
|
||||
public EntityLoadContext getEntityLoadContext(ResultSet resultSet) {
|
||||
EntityLoadContext context = null;
|
||||
if ( entityLoadContexts == null ) {
|
||||
entityLoadContexts = IdentityMap.instantiate( 8 );
|
||||
}
|
||||
else {
|
||||
context = ( EntityLoadContext ) entityLoadContexts.get( resultSet );
|
||||
}
|
||||
if ( context == null ) {
|
||||
context = new EntityLoadContext( this, resultSet );
|
||||
entityLoadContexts.put( resultSet, context );
|
||||
}
|
||||
return context;
|
||||
}
|
||||
}
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.collection.PersistentCollection;
|
||||
import org.hibernate.engine.CollectionKey;
|
||||
import org.hibernate.engine.PersistenceContext;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.internal.util.collections.IdentityMap;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
* Maps {@link ResultSet result-sets} to specific contextual data
|
||||
* related to processing that {@link ResultSet result-sets}.
|
||||
* <p/>
|
||||
* Implementation note: internally an {@link IdentityMap} is used to maintain
|
||||
* the mappings; {@link IdentityMap} was chosen because I'd rather not be
|
||||
* dependent upon potentially bad {@link ResultSet#equals} and {ResultSet#hashCode}
|
||||
* implementations.
|
||||
* <p/>
|
||||
* Considering the JDBC-redesign work, would further like this contextual info
|
||||
* not mapped seperately, but available based on the result set being processed.
|
||||
* This would also allow maintaining a single mapping as we could reliably get
|
||||
* notification of the result-set closing...
|
||||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class LoadContexts {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, LoadContexts.class.getName());
|
||||
|
||||
private final PersistenceContext persistenceContext;
|
||||
private Map collectionLoadContexts;
|
||||
private Map entityLoadContexts;
|
||||
|
||||
private Map xrefLoadingCollectionEntries;
|
||||
|
||||
/**
|
||||
* Creates and binds this to the given persistence context.
|
||||
*
|
||||
* @param persistenceContext The persistence context to which this
|
||||
* will be bound.
|
||||
*/
|
||||
public LoadContexts(PersistenceContext persistenceContext) {
|
||||
this.persistenceContext = persistenceContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the persistence context to which this is bound.
|
||||
*
|
||||
* @return The persistence context to which this is bound.
|
||||
*/
|
||||
public PersistenceContext getPersistenceContext() {
|
||||
return persistenceContext;
|
||||
}
|
||||
|
||||
private SessionImplementor getSession() {
|
||||
return getPersistenceContext().getSession();
|
||||
}
|
||||
|
||||
private EntityMode getEntityMode() {
|
||||
return getSession().getEntityMode();
|
||||
}
|
||||
|
||||
|
||||
// cleanup code ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
/**
|
||||
* Release internal state associated with the given result set.
|
||||
* <p/>
|
||||
* This should be called when we are done with processing said result set,
|
||||
* ideally as the result set is being closed.
|
||||
*
|
||||
* @param resultSet The result set for which it is ok to release
|
||||
* associated resources.
|
||||
*/
|
||||
public void cleanup(ResultSet resultSet) {
|
||||
if ( collectionLoadContexts != null ) {
|
||||
CollectionLoadContext collectionLoadContext = ( CollectionLoadContext ) collectionLoadContexts.remove( resultSet );
|
||||
collectionLoadContext.cleanup();
|
||||
}
|
||||
if ( entityLoadContexts != null ) {
|
||||
EntityLoadContext entityLoadContext = ( EntityLoadContext ) entityLoadContexts.remove( resultSet );
|
||||
entityLoadContext.cleanup();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Release internal state associated with *all* result sets.
|
||||
* <p/>
|
||||
* This is intended as a "failsafe" process to make sure we get everything
|
||||
* cleaned up and released.
|
||||
*/
|
||||
public void cleanup() {
|
||||
if ( collectionLoadContexts != null ) {
|
||||
Iterator itr = collectionLoadContexts.values().iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
CollectionLoadContext collectionLoadContext = ( CollectionLoadContext ) itr.next();
|
||||
LOG.failSafeCollectionsCleanup(collectionLoadContext);
|
||||
collectionLoadContext.cleanup();
|
||||
}
|
||||
collectionLoadContexts.clear();
|
||||
}
|
||||
if ( entityLoadContexts != null ) {
|
||||
Iterator itr = entityLoadContexts.values().iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
EntityLoadContext entityLoadContext = ( EntityLoadContext ) itr.next();
|
||||
LOG.failSafeEntitiesCleanup(entityLoadContext);
|
||||
entityLoadContext.cleanup();
|
||||
}
|
||||
entityLoadContexts.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Collection load contexts ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
/**
|
||||
* Do we currently have any internal entries corresponding to loading
|
||||
* collections?
|
||||
*
|
||||
* @return True if we currently hold state pertaining to loading collections;
|
||||
* false otherwise.
|
||||
*/
|
||||
public boolean hasLoadingCollectionEntries() {
|
||||
return ( collectionLoadContexts != null && !collectionLoadContexts.isEmpty() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Do we currently have any registered internal entries corresponding to loading
|
||||
* collections?
|
||||
*
|
||||
* @return True if we currently hold state pertaining to a registered loading collections;
|
||||
* false otherwise.
|
||||
*/
|
||||
public boolean hasRegisteredLoadingCollectionEntries() {
|
||||
return ( xrefLoadingCollectionEntries != null && !xrefLoadingCollectionEntries.isEmpty() );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the {@link CollectionLoadContext} associated with the given
|
||||
* {@link ResultSet}, creating one if needed.
|
||||
*
|
||||
* @param resultSet The result set for which to retrieve the context.
|
||||
* @return The processing context.
|
||||
*/
|
||||
public CollectionLoadContext getCollectionLoadContext(ResultSet resultSet) {
|
||||
CollectionLoadContext context = null;
|
||||
if (collectionLoadContexts == null) collectionLoadContexts = IdentityMap.instantiate(8);
|
||||
else context = (CollectionLoadContext)collectionLoadContexts.get(resultSet);
|
||||
if ( context == null ) {
|
||||
LOG.trace("Constructing collection load context for result set [" + resultSet + "]");
|
||||
context = new CollectionLoadContext( this, resultSet );
|
||||
collectionLoadContexts.put( resultSet, context );
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to locate the loading collection given the owner's key. The lookup here
|
||||
* occurs against all result-set contexts...
|
||||
*
|
||||
* @param persister The collection persister
|
||||
* @param ownerKey The owner key
|
||||
* @return The loading collection, or null if not found.
|
||||
*/
|
||||
public PersistentCollection locateLoadingCollection(CollectionPersister persister, Serializable ownerKey) {
|
||||
LoadingCollectionEntry lce = locateLoadingCollectionEntry( new CollectionKey( persister, ownerKey, getEntityMode() ) );
|
||||
if ( lce != null ) {
|
||||
if (LOG.isTraceEnabled()) LOG.trace("Returning loading collection: "
|
||||
+ MessageHelper.collectionInfoString(persister, ownerKey, getSession().getFactory()));
|
||||
return lce.getCollection();
|
||||
}
|
||||
// TODO : should really move this log statement to CollectionType, where this is used from...
|
||||
if (LOG.isTraceEnabled()) LOG.trace("Creating collection wrapper: "
|
||||
+ MessageHelper.collectionInfoString(persister, ownerKey, getSession().getFactory()));
|
||||
return null;
|
||||
}
|
||||
|
||||
// loading collection xrefs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
/**
|
||||
* Register a loading collection xref.
|
||||
* <p/>
|
||||
* This xref map is used because sometimes a collection is in process of
|
||||
* being loaded from one result set, but needs to be accessed from the
|
||||
* context of another "nested" result set processing.
|
||||
* <p/>
|
||||
* Implementation note: package protected, as this is meant solely for use
|
||||
* by {@link CollectionLoadContext} to be able to locate collections
|
||||
* being loaded by other {@link CollectionLoadContext}s/{@link ResultSet}s.
|
||||
*
|
||||
* @param entryKey The xref collection key
|
||||
* @param entry The corresponding loading collection entry
|
||||
*/
|
||||
void registerLoadingCollectionXRef(CollectionKey entryKey, LoadingCollectionEntry entry) {
|
||||
if ( xrefLoadingCollectionEntries == null ) {
|
||||
xrefLoadingCollectionEntries = new HashMap();
|
||||
}
|
||||
xrefLoadingCollectionEntries.put( entryKey, entry );
|
||||
}
|
||||
|
||||
/**
|
||||
* The inverse of {@link #registerLoadingCollectionXRef}. Here, we are done
|
||||
* processing the said collection entry, so we remove it from the
|
||||
* load context.
|
||||
* <p/>
|
||||
* The idea here is that other loading collections can now reference said
|
||||
* collection directly from the {@link PersistenceContext} because it
|
||||
* has completed its load cycle.
|
||||
* <p/>
|
||||
* Implementation note: package protected, as this is meant solely for use
|
||||
* by {@link CollectionLoadContext} to be able to locate collections
|
||||
* being loaded by other {@link CollectionLoadContext}s/{@link ResultSet}s.
|
||||
*
|
||||
* @param key The key of the collection we are done processing.
|
||||
*/
|
||||
void unregisterLoadingCollectionXRef(CollectionKey key) {
|
||||
if ( !hasRegisteredLoadingCollectionEntries() ) {
|
||||
return;
|
||||
}
|
||||
xrefLoadingCollectionEntries.remove(key);
|
||||
}
|
||||
|
||||
/*package*/Map getLoadingCollectionXRefs() {
|
||||
return xrefLoadingCollectionEntries;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Locate the LoadingCollectionEntry within *any* of the tracked
|
||||
* {@link CollectionLoadContext}s.
|
||||
* <p/>
|
||||
* Implementation note: package protected, as this is meant solely for use
|
||||
* by {@link CollectionLoadContext} to be able to locate collections
|
||||
* being loaded by other {@link CollectionLoadContext}s/{@link ResultSet}s.
|
||||
*
|
||||
* @param key The collection key.
|
||||
* @return The located entry; or null.
|
||||
*/
|
||||
LoadingCollectionEntry locateLoadingCollectionEntry(CollectionKey key) {
|
||||
if (xrefLoadingCollectionEntries == null) return null;
|
||||
LOG.trace("Attempting to locate loading collection entry [" + key + "] in any result-set context");
|
||||
LoadingCollectionEntry rtn = ( LoadingCollectionEntry ) xrefLoadingCollectionEntries.get( key );
|
||||
if (rtn == null) LOG.trace("Collection [" + key + "] not located in load context");
|
||||
else LOG.trace("Collection [" + key + "] located in load context");
|
||||
return rtn;
|
||||
}
|
||||
|
||||
/*package*/void cleanupCollectionXRefs(Set entryKeys) {
|
||||
Iterator itr = entryKeys.iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
final CollectionKey entryKey = ( CollectionKey ) itr.next();
|
||||
xrefLoadingCollectionEntries.remove( entryKey );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Entity load contexts ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// * currently, not yet used...
|
||||
|
||||
public EntityLoadContext getEntityLoadContext(ResultSet resultSet) {
|
||||
EntityLoadContext context = null;
|
||||
if ( entityLoadContexts == null ) {
|
||||
entityLoadContexts = IdentityMap.instantiate( 8 );
|
||||
}
|
||||
else {
|
||||
context = ( EntityLoadContext ) entityLoadContexts.get( resultSet );
|
||||
}
|
||||
if ( context == null ) {
|
||||
context = new EntityLoadContext( this, resultSet );
|
||||
entityLoadContexts.put( resultSet, context );
|
||||
}
|
||||
return context;
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@
|
||||
package org.hibernate.engine.profile;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.type.BagType;
|
||||
import org.hibernate.type.Type;
|
||||
@ -40,7 +40,7 @@
|
||||
*/
|
||||
public class FetchProfile {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, FetchProfile.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, FetchProfile.class.getName());
|
||||
|
||||
private final String name;
|
||||
private Map<String,Fetch> fetches = new HashMap<String,Fetch>();
|
||||
|
@ -35,7 +35,7 @@
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.ScrollableResults;
|
||||
import org.hibernate.engine.QueryParameters;
|
||||
@ -62,7 +62,7 @@ public class HQLQueryPlan implements Serializable {
|
||||
|
||||
// TODO : keep separate notions of QT[] here for shallow/non-shallow queries...
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, HQLQueryPlan.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, HQLQueryPlan.class.getName());
|
||||
|
||||
private final String sourceQuery;
|
||||
private final QueryTranslator[] translators;
|
||||
|
@ -31,7 +31,7 @@
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.action.internal.BulkOperationCleanupAction;
|
||||
import org.hibernate.engine.QueryParameters;
|
||||
@ -55,7 +55,7 @@ public class NativeSQLQueryPlan implements Serializable {
|
||||
|
||||
private final SQLCustomQuery customQuery;
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, NativeSQLQueryPlan.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, NativeSQLQueryPlan.class.getName());
|
||||
|
||||
public NativeSQLQueryPlan(
|
||||
NativeSQLQuerySpecification specification,
|
||||
|
@ -31,7 +31,8 @@
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.cfg.Environment;
|
||||
@ -42,6 +43,7 @@
|
||||
import org.hibernate.internal.util.collections.SimpleMRUCache;
|
||||
import org.hibernate.internal.util.collections.SoftLimitMRUCache;
|
||||
import org.hibernate.internal.util.config.ConfigurationHelper;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -54,7 +56,7 @@
|
||||
*/
|
||||
public class QueryPlanCache implements Serializable {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, QueryPlanCache.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, QueryPlanCache.class.getName());
|
||||
|
||||
private SessionFactoryImplementor factory;
|
||||
|
||||
|
@ -25,7 +25,8 @@
|
||||
|
||||
import java.util.LinkedHashSet;
|
||||
import javax.transaction.Synchronization;
|
||||
import org.hibernate.HibernateLogger;
|
||||
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.engine.transaction.spi.SynchronizationRegistry;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
@ -36,7 +37,7 @@
|
||||
*/
|
||||
public class SynchronizationRegistryImpl implements SynchronizationRegistry {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
SynchronizationRegistryImpl.class.getName());
|
||||
|
||||
private LinkedHashSet<Synchronization> synchronizations;
|
||||
|
@ -24,7 +24,7 @@
|
||||
package org.hibernate.engine.transaction.internal;
|
||||
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.ResourceClosedException;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl;
|
||||
@ -61,7 +61,7 @@
|
||||
*/
|
||||
public class TransactionCoordinatorImpl implements TransactionCoordinator {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, TransactionCoordinatorImpl.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, TransactionCoordinatorImpl.class.getName());
|
||||
|
||||
private final transient TransactionContext transactionContext;
|
||||
private final transient JdbcCoordinatorImpl jdbcCoordinator;
|
||||
|
@ -28,7 +28,7 @@
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory;
|
||||
import org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory;
|
||||
@ -45,7 +45,7 @@
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class TransactionFactoryInitiator<T extends TransactionImplementor> implements BasicServiceInitiator<TransactionFactory> {
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class,
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
TransactionFactoryInitiator.class.getName());
|
||||
|
||||
public static final TransactionFactoryInitiator INSTANCE = new TransactionFactoryInitiator();
|
||||
|
@ -26,13 +26,14 @@
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.HibernateLogger;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.engine.jdbc.spi.SqlExceptionHelper;
|
||||
import org.hibernate.engine.transaction.spi.IsolationDelegate;
|
||||
import org.hibernate.engine.transaction.spi.TransactionCoordinator;
|
||||
import org.hibernate.jdbc.WorkExecutorVisitable;
|
||||
import org.hibernate.jdbc.WorkExecutor;
|
||||
import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
/**
|
||||
@ -42,7 +43,7 @@
|
||||
*/
|
||||
public class JdbcIsolationDelegate implements IsolationDelegate {
|
||||
|
||||
private static final HibernateLogger LOG = Logger.getMessageLogger(HibernateLogger.class, JdbcIsolationDelegate.class.getName());
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, JdbcIsolationDelegate.class.getName());
|
||||
|
||||
private final TransactionCoordinator transactionCoordinator;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user