Give each project a single logger
This commit is contained in:
parent
9b7eb48b55
commit
3712e1ad7e
|
@ -27,19 +27,13 @@ import java.sql.Connection;
|
|||
import java.sql.SQLException;
|
||||
import java.util.Iterator;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.mchange.v2.c3p0.DataSources;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.internal.util.config.ConfigurationHelper;
|
||||
import org.hibernate.service.jdbc.connections.spi.ConnectionProvider;
|
||||
import org.hibernate.util.ReflectHelper;
|
||||
import com.mchange.v2.c3p0.DataSources;
|
||||
|
||||
/**
|
||||
* A connection provider that uses a C3P0 connection pool. Hibernate will use this by
|
||||
|
@ -50,7 +44,7 @@ import org.hibernate.util.ReflectHelper;
|
|||
*/
|
||||
public class C3P0ConnectionProvider implements ConnectionProvider {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger( C3P0ConnectionProvider.class );
|
||||
private static final C3P0Logger LOG = org.jboss.logging.Logger.getMessageLogger(C3P0Logger.class, C3P0Logger.class.getPackage().getName());
|
||||
|
||||
//swaldman 2006-08-28: define c3p0-style configuration parameters for properties with
|
||||
// hibernate-specific overrides to detect and warn about conflicting
|
||||
|
@ -61,7 +55,7 @@ public class C3P0ConnectionProvider implements ConnectionProvider {
|
|||
private final static String C3P0_STYLE_MAX_STATEMENTS = "c3p0.maxStatements";
|
||||
private final static String C3P0_STYLE_ACQUIRE_INCREMENT = "c3p0.acquireIncrement";
|
||||
private final static String C3P0_STYLE_IDLE_CONNECTION_TEST_PERIOD = "c3p0.idleConnectionTestPeriod";
|
||||
private final static String C3P0_STYLE_TEST_CONNECTION_ON_CHECKOUT = "c3p0.testConnectionOnCheckout";
|
||||
// private final static String C3P0_STYLE_TEST_CONNECTION_ON_CHECKOUT = "c3p0.testConnectionOnCheckout";
|
||||
|
||||
//swaldman 2006-08-28: define c3p0-style configuration parameters for initialPoolSize, which
|
||||
// hibernate sensibly lets default to minPoolSize, but we'll let users
|
||||
|
@ -93,23 +87,22 @@ public class C3P0ConnectionProvider implements ConnectionProvider {
|
|||
conn.close();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
/**
|
||||
* @param props
|
||||
* @throws HibernateException
|
||||
*/
|
||||
public void configure(Properties props) throws HibernateException {
|
||||
String jdbcDriverClass = props.getProperty( Environment.DRIVER );
|
||||
String jdbcUrl = props.getProperty( Environment.URL );
|
||||
Properties connectionProps = ConnectionProviderInitiator.getConnectionProperties( props );
|
||||
|
||||
log.info( "C3P0 using driver: " + jdbcDriverClass + " at URL: " + jdbcUrl );
|
||||
log.info( "Connection properties: " + ConfigurationHelper.maskOut( connectionProps, "password" ) );
|
||||
LOG.c3p0UsingDriver(jdbcDriverClass, jdbcUrl);
|
||||
LOG.connectionProperties(ConfigurationHelper.maskOut(connectionProps, "password"));
|
||||
|
||||
autocommit = ConfigurationHelper.getBoolean( Environment.AUTOCOMMIT, props );
|
||||
log.info( "autocommit mode: " + autocommit );
|
||||
LOG.autoCommitMode(autocommit);
|
||||
|
||||
if ( jdbcDriverClass == null ) {
|
||||
log.warn( "No JDBC Driver class was specified by property " + Environment.DRIVER );
|
||||
}
|
||||
if (jdbcDriverClass == null) LOG.jdbcDriverNotSpecified(Environment.DRIVER);
|
||||
else {
|
||||
try {
|
||||
Class.forName( jdbcDriverClass );
|
||||
|
@ -119,8 +112,8 @@ public class C3P0ConnectionProvider implements ConnectionProvider {
|
|||
ReflectHelper.classForName( jdbcDriverClass );
|
||||
}
|
||||
catch ( ClassNotFoundException e ) {
|
||||
String msg = "JDBC Driver class not found: " + jdbcDriverClass;
|
||||
log.error( msg, e );
|
||||
String msg = LOG.jdbcDriverNotFound(jdbcDriverClass);
|
||||
LOG.error(msg, e);
|
||||
throw new HibernateException( msg, e );
|
||||
}
|
||||
}
|
||||
|
@ -182,30 +175,28 @@ public class C3P0ConnectionProvider implements ConnectionProvider {
|
|||
ds = DataSources.pooledDataSource( unpooled, allProps );
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
log.error( "could not instantiate C3P0 connection pool", e );
|
||||
LOG.error(LOG.unableToInstantiateC3p0ConnectionPool(), e);
|
||||
throw new HibernateException( "Could not instantiate C3P0 connection pool", e );
|
||||
}
|
||||
|
||||
String i = props.getProperty( Environment.ISOLATION );
|
||||
if ( i == null ) {
|
||||
isolation = null;
|
||||
}
|
||||
if (i == null) isolation = null;
|
||||
else {
|
||||
isolation = new Integer( i );
|
||||
log.info( "JDBC isolation level: " + Environment.isolationLevelToString( isolation.intValue() ) );
|
||||
LOG.jdbcIsolationLevel(Environment.isolationLevelToString(isolation.intValue()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public void close() {
|
||||
try {
|
||||
DataSources.destroy( ds );
|
||||
}
|
||||
catch ( SQLException sqle ) {
|
||||
log.warn( "could not destroy C3P0 connection pool", sqle );
|
||||
LOG.warn(LOG.unableToDestroyC3p0ConnectionPool(), sqle);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,12 +221,6 @@ public class C3P0ConnectionProvider implements ConnectionProvider {
|
|||
}
|
||||
|
||||
private void warnPropertyConflict(String hibernateStyle, String c3p0Style) {
|
||||
log.warn(
|
||||
"Both hibernate-style property '" + hibernateStyle +
|
||||
"' and c3p0-style property '" + c3p0Style +
|
||||
"' have been set in hibernate.properties. " +
|
||||
"Hibernate-style property '" + hibernateStyle + "' will be used " +
|
||||
"and c3p0-style property '" + c3p0Style + "' will be ignored!"
|
||||
);
|
||||
LOG.bothHibernateAndC3p0StylesSet(hibernateStyle, c3p0Style, hibernateStyle, c3p0Style);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,11 +24,6 @@
|
|||
*/
|
||||
package org.hibernate;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.ERROR;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Indicates failure of an assertion: a possible bug in Hibernate.
|
||||
*
|
||||
|
@ -50,16 +45,4 @@ public class AssertionFailure extends RuntimeException {
|
|||
super(s, t);
|
||||
LOG.failed(t);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger {
|
||||
|
||||
@LogMessage( level = ERROR )
|
||||
@Message( value = "an assertion failure occured" + " (this may indicate a bug in Hibernate, but is more likely due"
|
||||
+ " to unsafe use of the session): %s" )
|
||||
void failed( Throwable throwable );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ import java.lang.reflect.Modifier;
|
|||
import net.sf.cglib.beans.BulkBean;
|
||||
import net.sf.cglib.beans.BulkBeanException;
|
||||
import net.sf.cglib.reflect.FastClass;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.bytecode.BytecodeProvider;
|
||||
import org.hibernate.bytecode.Logger;
|
||||
import org.hibernate.bytecode.ProxyFactoryFactory;
|
||||
import org.hibernate.bytecode.ReflectionOptimizer;
|
||||
import org.hibernate.bytecode.util.FieldFilter;
|
||||
|
@ -82,25 +82,17 @@ public class BytecodeProviderImpl implements BytecodeProvider {
|
|||
if (LOG.isDebugEnabled()) {
|
||||
int index = 0;
|
||||
if (t instanceof BulkBeanException) index = ((BulkBeanException)t).getIndex();
|
||||
if (index >= 0) LOG.reflectionOptimizerDisabledForBulkException(clazz.getName(),
|
||||
StringHelper.unqualify(t.getClass().getName()),
|
||||
t.getMessage(),
|
||||
setterNames[index]);
|
||||
else LOG.reflectionOptimizerDisabled(clazz.getName(),
|
||||
StringHelper.unqualify(t.getClass().getName()),
|
||||
t.getMessage());
|
||||
if (index >= 0) LOG.debug("Reflection optimizer disabled for: " + clazz.getName() + " ["
|
||||
+ StringHelper.unqualify(t.getClass().getName()) + ": " + t.getMessage() + " (property "
|
||||
+ setterNames[index] + ")");
|
||||
else LOG.debug("Reflection optimizer disabled for: " + clazz.getName() + " ["
|
||||
+ StringHelper.unqualify(t.getClass().getName()) + ": " + t.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ( fastClass != null && bulkBean != null ) {
|
||||
return new ReflectionOptimizerImpl(
|
||||
new InstantiationOptimizerAdapter( fastClass ),
|
||||
new AccessOptimizerAdapter( bulkBean, clazz )
|
||||
);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
if (fastClass != null && bulkBean != null) return new ReflectionOptimizerImpl(new InstantiationOptimizerAdapter(fastClass),
|
||||
new AccessOptimizerAdapter(bulkBean, clazz));
|
||||
return null;
|
||||
}
|
||||
|
||||
public org.hibernate.bytecode.ClassTransformer getTransformer(org.hibernate.bytecode.util.ClassFilter classFilter, FieldFilter fieldFilter) {
|
||||
|
|
|
@ -37,8 +37,8 @@ import net.sf.cglib.transform.impl.InterceptFieldEnabled;
|
|||
import net.sf.cglib.transform.impl.InterceptFieldFilter;
|
||||
import net.sf.cglib.transform.impl.InterceptFieldTransformer;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.bytecode.AbstractClassTransformerImpl;
|
||||
import org.hibernate.bytecode.Logger;
|
||||
import org.hibernate.bytecode.util.ClassFilter;
|
||||
import org.hibernate.bytecode.util.FieldFilter;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
|
@ -82,7 +82,7 @@ public class CglibClassTransformer extends AbstractClassTransformerImpl {
|
|||
ClassWriter w = new DebuggingClassWriter( ClassWriter.COMPUTE_MAXS );
|
||||
ClassTransformer t = getClassTransformer( names );
|
||||
if ( t != null ) {
|
||||
LOG.enhancingClass(className);
|
||||
LOG.debug("Enhancing " + className);
|
||||
ByteArrayOutputStream out;
|
||||
byte[] result;
|
||||
try {
|
||||
|
|
|
@ -25,9 +25,9 @@
|
|||
package org.hibernate.bytecode.javassist;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.bytecode.BytecodeProvider;
|
||||
import org.hibernate.bytecode.ClassTransformer;
|
||||
import org.hibernate.bytecode.Logger;
|
||||
import org.hibernate.bytecode.ProxyFactoryFactory;
|
||||
import org.hibernate.bytecode.ReflectionOptimizer;
|
||||
import org.hibernate.bytecode.util.ClassFilter;
|
||||
|
@ -74,13 +74,11 @@ public class BytecodeProviderImpl implements BytecodeProvider {
|
|||
if (LOG.isDebugEnabled()) {
|
||||
int index = 0;
|
||||
if (t instanceof BulkAccessorException) index = ((BulkAccessorException)t).getIndex();
|
||||
if (index >= 0) LOG.reflectionOptimizerDisabledForBulkException(clazz.getName(),
|
||||
StringHelper.unqualify(t.getClass().getName()),
|
||||
t.getMessage(),
|
||||
setterNames[index]);
|
||||
else LOG.reflectionOptimizerDisabled(clazz.getName(),
|
||||
StringHelper.unqualify(t.getClass().getName()),
|
||||
t.getMessage());
|
||||
if (index >= 0) LOG.debug("Reflection optimizer disabled for: " + clazz.getName() + " ["
|
||||
+ StringHelper.unqualify(t.getClass().getName()) + ": " + t.getMessage() + " (property "
|
||||
+ setterNames[index] + ")");
|
||||
else LOG.debug("Reflection optimizer disabled for: " + clazz.getName() + " ["
|
||||
+ StringHelper.unqualify(t.getClass().getName()) + ": " + t.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,9 +88,7 @@ public class BytecodeProviderImpl implements BytecodeProvider {
|
|||
new AccessOptimizerAdapter( bulkAccessor, clazz )
|
||||
);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ClassTransformer getTransformer(ClassFilter classFilter, FieldFilter fieldFilter) {
|
||||
|
|
|
@ -32,8 +32,8 @@ import java.io.IOException;
|
|||
import java.security.ProtectionDomain;
|
||||
import javassist.bytecode.ClassFile;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.bytecode.AbstractClassTransformerImpl;
|
||||
import org.hibernate.bytecode.Logger;
|
||||
import org.hibernate.bytecode.util.ClassFilter;
|
||||
|
||||
/**
|
||||
|
@ -69,7 +69,7 @@ public class JavassistClassTransformer extends AbstractClassTransformerImpl {
|
|||
}
|
||||
FieldTransformer transformer = getFieldTransformer( classfile );
|
||||
if ( transformer != null ) {
|
||||
LOG.enhancingClass("Enhancing " + className);
|
||||
LOG.debug("Enhancing " + className);
|
||||
DataOutputStream out = null;
|
||||
try {
|
||||
transformer.transform( classfile );
|
||||
|
|
|
@ -28,6 +28,7 @@ import java.util.Properties;
|
|||
import javax.naming.Context;
|
||||
import javax.naming.InitialContext;
|
||||
import javax.naming.NamingException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.internal.util.jndi.JndiHelper;
|
||||
import org.hibernate.util.StringHelper;
|
||||
|
|
|
@ -1,218 +0,0 @@
|
|||
/*
|
||||
* JBoss, Home of Professional Open Source.
|
||||
*
|
||||
* See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing.
|
||||
*
|
||||
* See the AUTHORS.txt file distributed with this work for a full listing of individual contributors.
|
||||
*/
|
||||
package org.hibernate.cache;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.ERROR;
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.io.Serializable;
|
||||
import java.util.Set;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Cached: %s" )
|
||||
void cached( Object key );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Caching: %s" )
|
||||
void caching( Object key );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Caching after insert: %s" )
|
||||
void cachingAfterInsert( Object key );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Caching query results in region: %s; timestamp=%s" )
|
||||
void cachingQueryResults( String region,
|
||||
Long ts );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Checking cached query results in region: %s" )
|
||||
void checkingQueryResults( String region );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Checking query spaces are up-to-date: %s" )
|
||||
void checkingQuerySpacesUpToDate( Set<Serializable> spaces );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Clearing" )
|
||||
void clearing();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Item already cached: %s" )
|
||||
void exists( Object key );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "An item was expired by the cache while it was locked (increase your cache timeout): %s" )
|
||||
void expired( Object key );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Cache hit: %s" )
|
||||
void hit( Object key );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Inserted: %s" )
|
||||
void inserted( Object key );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Inserting: %s" )
|
||||
void inserting( Object key );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Invalidating: %s" )
|
||||
void invalidating( Object key );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Invalidating space [%s], timestamp: %s" )
|
||||
void invalidatingSpace( Serializable space,
|
||||
Long ts );
|
||||
|
||||
@LogMessage( level = ERROR )
|
||||
@Message( value = "Application attempted to edit read only item: %s" )
|
||||
void invalidEditOfReadOnlyItem( Object key );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "key.hashCode=%s" )
|
||||
void key( int hashCode );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Cached item was locked: %s" )
|
||||
void locked( Object key );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Cache lookup: %s" )
|
||||
void lookup( Object key );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Cache miss: %s" )
|
||||
void miss( Object key );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = " tuple is null; returnTypes is %s" )
|
||||
void nullTuple( String returnTypesState );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Pre-invalidating space [%s]" )
|
||||
void preInvalidatingSpace( Serializable space );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Query results were not found in cache" )
|
||||
void queryResultsNotFound();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Cached query results were not up-to-date" )
|
||||
void queryResultsNotUpToDate();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "querySpaces=%s" )
|
||||
void querySpaces( Set<Serializable> spaces );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Releasing: %s" )
|
||||
void releasing( Object key );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Removing: %s" )
|
||||
void removing( Object key );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Returning cached query results" )
|
||||
void returningQueryResults();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "unexpected returnTypes is %s! result%s" )
|
||||
void returnTypeInfo( String returnTypeInfo );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "[%s] last update timestamp: %d, result set timestamp: %d" )
|
||||
void spaceLastUpdated( Serializable space,
|
||||
long lastUpdate,
|
||||
long timestamp );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Starting query cache at region: %s" )
|
||||
void startingQueryCache( String region );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Starting update timestamps cache at region: %s" )
|
||||
void startingUpdateTimestampsCache( String region );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = " tuple is Object[%d]; returnTypes is Type[%d]" )
|
||||
void tupleAndReturnTypes( int tupleCount,
|
||||
int returnTypeCount );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Unable to destroy cache: %s" )
|
||||
void unableToDestroyCache( String message );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Unable to destroy query cache: %s: %s" )
|
||||
void unableToDestroyQueryCache( String region,
|
||||
String message );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Unable to destroy update timestamps cache: %s: %s" )
|
||||
void unableToDestroyUpdateTimestampsCache( String region,
|
||||
String message );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Unable to reassemble cached result set" )
|
||||
void unableToReassembleResultSet();
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Unable to release initial context: %s" )
|
||||
void unableToReleaseContext( String message );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Unable to retreive cache from JNDI [%s]: %s" )
|
||||
void unableToRetrieveCache( String namespace,
|
||||
String message );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Unexpected result tuple! tuple is null; returnTypes is %s" )
|
||||
void unexpectedNonNullTupleResult( String returnTypesState );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Unexpected result tuple! tuple is null; should be Object[%d]!" )
|
||||
void unexpectedNullTupleResult( int returnTypeCount );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Unexpected returnTypes is %s! result%s" )
|
||||
void unexpectedReturnTypes( String returnTypesState,
|
||||
String resultState );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Unexpected tuple length! transformer= expected=%d got=%d" )
|
||||
void unexpectedTupleCount( int returntypesCount,
|
||||
int tupleCount );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Unexpected tuple value type! transformer= expected=%s got=%s" )
|
||||
void unexpectedTupleValueType( String returnTypeClassName,
|
||||
String tupleClassName );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Updated: %s" )
|
||||
void updated( Object key );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Updating: %s" )
|
||||
void updating( Object key );
|
||||
}
|
|
@ -25,6 +25,7 @@
|
|||
package org.hibernate.cache;
|
||||
|
||||
import java.util.Comparator;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.cache.access.SoftLock;
|
||||
|
||||
/**
|
||||
|
@ -58,15 +59,11 @@ public class NonstrictReadWriteCache implements CacheConcurrencyStrategy {
|
|||
* Get the most recent version, if available.
|
||||
*/
|
||||
public Object get(Object key, long txTimestamp) throws CacheException {
|
||||
LOG.lookup(key);
|
||||
LOG.debug("Cache lookup: " + key);
|
||||
|
||||
Object result = cache.get( key );
|
||||
if ( result != null ) {
|
||||
LOG.hit(key);
|
||||
}
|
||||
else {
|
||||
LOG.miss(key);
|
||||
}
|
||||
if (result != null) LOG.debug("Cache hit: " + key);
|
||||
else LOG.debug("Cache miss: " + key);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -81,10 +78,10 @@ public class NonstrictReadWriteCache implements CacheConcurrencyStrategy {
|
|||
Comparator versionComparator,
|
||||
boolean minimalPut) throws CacheException {
|
||||
if ( minimalPut && cache.get( key ) != null ) {
|
||||
LOG.exists(key);
|
||||
LOG.debug("Item already cached: " + key);
|
||||
return false;
|
||||
}
|
||||
LOG.caching(key);
|
||||
LOG.debug("Caching: " + key);
|
||||
|
||||
cache.put( key, value );
|
||||
return true;
|
||||
|
@ -101,12 +98,12 @@ public class NonstrictReadWriteCache implements CacheConcurrencyStrategy {
|
|||
}
|
||||
|
||||
public void remove(Object key) throws CacheException {
|
||||
LOG.removing(key);
|
||||
LOG.debug("Removing: " + key);
|
||||
cache.remove( key );
|
||||
}
|
||||
|
||||
public void clear() throws CacheException {
|
||||
LOG.clearing();
|
||||
LOG.debug("Clearing");
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
|
@ -123,7 +120,7 @@ public class NonstrictReadWriteCache implements CacheConcurrencyStrategy {
|
|||
* Invalidate the item
|
||||
*/
|
||||
public void evict(Object key) throws CacheException {
|
||||
LOG.invalidating(key);
|
||||
LOG.debug("Invalidating: " + key);
|
||||
cache.remove( key );
|
||||
}
|
||||
|
||||
|
@ -146,7 +143,7 @@ public class NonstrictReadWriteCache implements CacheConcurrencyStrategy {
|
|||
* Invalidate the item (again, for safety).
|
||||
*/
|
||||
public void release(Object key, SoftLock lock) throws CacheException {
|
||||
LOG.invalidating(key);
|
||||
LOG.debug("Invalidating: " + key);
|
||||
cache.remove( key );
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package org.hibernate.cache;
|
||||
|
||||
import java.util.Comparator;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.cache.access.SoftLock;
|
||||
|
||||
/**
|
||||
|
@ -53,7 +54,7 @@ public class ReadOnlyCache implements CacheConcurrencyStrategy {
|
|||
|
||||
public synchronized Object get(Object key, long timestamp) throws CacheException {
|
||||
Object result = cache.get(key);
|
||||
if (result != null) LOG.hit(key);
|
||||
if (result != null) LOG.debug("Cache hit: " + key);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -74,10 +75,10 @@ public class ReadOnlyCache implements CacheConcurrencyStrategy {
|
|||
boolean minimalPut)
|
||||
throws CacheException {
|
||||
if ( minimalPut && cache.get(key)!=null ) {
|
||||
LOG.exists(key);
|
||||
LOG.debug("Item already cached: " + key);
|
||||
return false;
|
||||
}
|
||||
LOG.caching(key);
|
||||
LOG.debug("Caching: " + key);
|
||||
cache.put(key, value);
|
||||
return true;
|
||||
}
|
||||
|
@ -119,7 +120,7 @@ public class ReadOnlyCache implements CacheConcurrencyStrategy {
|
|||
* Do nothing.
|
||||
*/
|
||||
public boolean afterInsert(Object key, Object value, Object version) throws CacheException {
|
||||
LOG.cachingAfterInsert(key);
|
||||
LOG.debug("Caching after insert: " + key);
|
||||
cache.update(key, value);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ package org.hibernate.cache;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.cache.access.SoftLock;
|
||||
|
||||
/**
|
||||
|
@ -92,15 +93,15 @@ public class ReadWriteCache implements CacheConcurrencyStrategy {
|
|||
* the data is versioned or timestamped.
|
||||
*/
|
||||
public synchronized Object get(Object key, long txTimestamp) throws CacheException {
|
||||
LOG.lookup(key);
|
||||
LOG.debug("Cache lookup: " + key);
|
||||
Lockable lockable = (Lockable)cache.get(key);
|
||||
boolean gettable = lockable != null && lockable.isGettable(txTimestamp);
|
||||
if (gettable) {
|
||||
LOG.hit(key);
|
||||
LOG.debug("Cache hit: " + key);
|
||||
return ((Item)lockable).getValue();
|
||||
}
|
||||
if (lockable == null) LOG.miss(key);
|
||||
else LOG.locked(key);
|
||||
if (lockable == null) LOG.debug("Cache miss: " + key);
|
||||
else LOG.debug("Cached item was locked: " + key);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -112,7 +113,7 @@ public class ReadWriteCache implements CacheConcurrencyStrategy {
|
|||
* item.
|
||||
*/
|
||||
public synchronized SoftLock lock(Object key, Object version) throws CacheException {
|
||||
LOG.invalidating(key);
|
||||
LOG.debug("Invalidating: " + key);
|
||||
try {
|
||||
cache.lock(key);
|
||||
|
||||
|
@ -146,7 +147,7 @@ public class ReadWriteCache implements CacheConcurrencyStrategy {
|
|||
Comparator versionComparator,
|
||||
boolean minimalPut)
|
||||
throws CacheException {
|
||||
LOG.caching(key);
|
||||
LOG.debug("Caching: " + key);
|
||||
|
||||
try {
|
||||
cache.lock(key);
|
||||
|
@ -158,14 +159,12 @@ public class ReadWriteCache implements CacheConcurrencyStrategy {
|
|||
|
||||
if (puttable) {
|
||||
cache.put( key, new Item( value, version, cache.nextTimestamp() ) );
|
||||
LOG.cached(key);
|
||||
LOG.debug("Cached: " + key);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
if (lockable.isLock()) LOG.locked(key);
|
||||
else LOG.exists(key);
|
||||
return false;
|
||||
}
|
||||
if (lockable.isLock()) LOG.debug("Cached item was locked: " + key);
|
||||
else LOG.debug("Item already cached: " + key);
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
cache.unlock(key);
|
||||
|
@ -187,7 +186,7 @@ public class ReadWriteCache implements CacheConcurrencyStrategy {
|
|||
* simultaneous lock).
|
||||
*/
|
||||
public synchronized void release(Object key, SoftLock clientLock) throws CacheException {
|
||||
LOG.releasing(key);
|
||||
LOG.debug("Releasing: " + key);
|
||||
|
||||
try {
|
||||
cache.lock(key);
|
||||
|
@ -238,7 +237,7 @@ public class ReadWriteCache implements CacheConcurrencyStrategy {
|
|||
public synchronized boolean afterUpdate(Object key, Object value, Object version, SoftLock clientLock)
|
||||
throws CacheException {
|
||||
|
||||
LOG.updating(key);
|
||||
LOG.debug("Updating: " + key);
|
||||
|
||||
try {
|
||||
cache.lock(key);
|
||||
|
@ -252,18 +251,13 @@ public class ReadWriteCache implements CacheConcurrencyStrategy {
|
|||
decrementLock(key, lock);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
//recache the updated state
|
||||
cache.update( key, new Item( value, version, cache.nextTimestamp() ) );
|
||||
LOG.updated(key);
|
||||
return true;
|
||||
}
|
||||
// recache the updated state
|
||||
cache.update(key, new Item(value, version, cache.nextTimestamp()));
|
||||
LOG.debug("Updated: " + key);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
handleLockExpiry(key);
|
||||
return false;
|
||||
}
|
||||
|
||||
handleLockExpiry(key);
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
cache.unlock(key);
|
||||
|
@ -277,19 +271,17 @@ public class ReadWriteCache implements CacheConcurrencyStrategy {
|
|||
public synchronized boolean afterInsert(Object key, Object value, Object version)
|
||||
throws CacheException {
|
||||
|
||||
LOG.inserting(key);
|
||||
LOG.debug("Inserting: " + key);
|
||||
try {
|
||||
cache.lock(key);
|
||||
|
||||
Lockable lockable = (Lockable) cache.get(key);
|
||||
if (lockable==null) {
|
||||
cache.update( key, new Item( value, version, cache.nextTimestamp() ) );
|
||||
LOG.inserted(key);
|
||||
LOG.debug("Inserted: " + key);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
finally {
|
||||
cache.unlock(key);
|
||||
|
|
|
@ -30,6 +30,7 @@ import java.util.Properties;
|
|||
import java.util.Set;
|
||||
import javax.persistence.EntityNotFoundException;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.UnresolvableObjectException;
|
||||
import org.hibernate.cfg.Settings;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
|
@ -81,32 +82,22 @@ public class StandardQueryCache implements QueryCache {
|
|||
List result,
|
||||
boolean isNaturalKeyLookup,
|
||||
SessionImplementor session) throws HibernateException {
|
||||
if ( isNaturalKeyLookup && result.size() == 0 ) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
Long ts = new Long( session.getFactory().getSettings().getRegionFactory().nextTimestamp());
|
||||
if (isNaturalKeyLookup && result.size() == 0) return false;
|
||||
Long ts = new Long(session.getFactory().getSettings().getRegionFactory().nextTimestamp());
|
||||
|
||||
LOG.cachingQueryResults(cacheRegion.getName(), ts);
|
||||
LOG.debug("Caching query results in region: " + cacheRegion.getName() + "; timestamp=" + ts);
|
||||
|
||||
List cacheable = new ArrayList( result.size() + 1 );
|
||||
logCachedResultDetails(key, null, returnTypes, cacheable);
|
||||
cacheable.add( ts );
|
||||
for ( Object aResult : result ) {
|
||||
if ( returnTypes.length == 1 ) {
|
||||
cacheable.add( returnTypes[0].disassemble( aResult, session, null ) );
|
||||
}
|
||||
else {
|
||||
cacheable.add(
|
||||
TypeHelper.disassemble( (Object[]) aResult, returnTypes, null, session, null )
|
||||
);
|
||||
}
|
||||
logCachedResultRowDetails(returnTypes, aResult);
|
||||
}
|
||||
List cacheable = new ArrayList(result.size() + 1);
|
||||
logCachedResultDetails(key, null, returnTypes, cacheable);
|
||||
cacheable.add(ts);
|
||||
for (Object aResult : result) {
|
||||
if (returnTypes.length == 1) cacheable.add(returnTypes[0].disassemble(aResult, session, null));
|
||||
else cacheable.add(TypeHelper.disassemble((Object[])aResult, returnTypes, null, session, null));
|
||||
logCachedResultRowDetails(returnTypes, aResult);
|
||||
}
|
||||
|
||||
cacheRegion.put( key, cacheable );
|
||||
return true;
|
||||
}
|
||||
cacheRegion.put(key, cacheable);
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
|
@ -116,23 +107,23 @@ public class StandardQueryCache implements QueryCache {
|
|||
boolean isNaturalKeyLookup,
|
||||
Set spaces,
|
||||
SessionImplementor session) throws HibernateException {
|
||||
LOG.checkingQueryResults(cacheRegion.getName());
|
||||
LOG.debug("Checking cached query results in region: " + cacheRegion.getName());
|
||||
|
||||
List cacheable = ( List ) cacheRegion.get( key );
|
||||
logCachedResultDetails(key, spaces, returnTypes, cacheable);
|
||||
|
||||
if ( cacheable == null ) {
|
||||
LOG.queryResultsNotFound();
|
||||
LOG.debug("Query results were not found in cache");
|
||||
return null;
|
||||
}
|
||||
|
||||
Long timestamp = ( Long ) cacheable.get( 0 );
|
||||
if ( !isNaturalKeyLookup && !isUpToDate( spaces, timestamp ) ) {
|
||||
LOG.queryResultsNotUpToDate();
|
||||
LOG.debug("Cached query results were not up-to-date");
|
||||
return null;
|
||||
}
|
||||
|
||||
LOG.returningQueryResults();
|
||||
LOG.debug("Returning cached query results");
|
||||
for ( int i = 1; i < cacheable.size(); i++ ) {
|
||||
if ( returnTypes.length == 1 ) {
|
||||
returnTypes[0].beforeAssemble( ( Serializable ) cacheable.get( i ), session );
|
||||
|
@ -162,20 +153,18 @@ public class StandardQueryCache implements QueryCache {
|
|||
// the uoe could occur while resolving
|
||||
// associations, leaving the PC in an
|
||||
// inconsistent state
|
||||
LOG.unableToReassembleResultSet();
|
||||
LOG.debug("Unable to reassemble cached result set");
|
||||
cacheRegion.evict( key );
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
throw ex;
|
||||
}
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
protected boolean isUpToDate(Set spaces, Long timestamp) {
|
||||
LOG.checkingQuerySpacesUpToDate(spaces);
|
||||
LOG.debug("Checking query spaces are up-to-date: " + spaces);
|
||||
return updateTimestampsCache.isUpToDate( spaces, timestamp );
|
||||
}
|
||||
|
||||
|
@ -199,12 +188,11 @@ public class StandardQueryCache implements QueryCache {
|
|||
|
||||
private static void logCachedResultDetails(QueryKey key, Set querySpaces, Type[] returnTypes, List result) {
|
||||
if (!LOG.isTraceEnabled()) return;
|
||||
LOG.key(key.hashCode());
|
||||
LOG.querySpaces(querySpaces);
|
||||
if ( returnTypes == null || returnTypes.length == 0 ) {
|
||||
LOG.unexpectedReturnTypes(returnTypes == null ? "null" : "empty",
|
||||
result == null ? " is null" : ".size()=" + result.size());
|
||||
}
|
||||
LOG.trace("key.hashCode=" + key.hashCode());
|
||||
LOG.trace("querySpaces=" + querySpaces);
|
||||
if (returnTypes == null || returnTypes.length == 0) LOG.trace("Unexpected returnTypes is "
|
||||
+ (returnTypes == null ? "null" : "empty") + "! result"
|
||||
+ (result == null ? " is null" : ".size()=" + result.size()));
|
||||
else {
|
||||
StringBuffer returnTypeInfo = new StringBuffer();
|
||||
for ( int i=0; i<returnTypes.length; i++ ) {
|
||||
|
@ -213,7 +201,7 @@ public class StandardQueryCache implements QueryCache {
|
|||
.append(" class=" )
|
||||
.append( returnTypes[ i ].getReturnedClass().getName() ).append(' ');
|
||||
}
|
||||
LOG.returnTypeInfo(returnTypeInfo.toString());
|
||||
LOG.trace("unexpected returnTypes is " + returnTypeInfo.toString() + "! result");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -228,16 +216,21 @@ public class StandardQueryCache implements QueryCache {
|
|||
private static void logCachedResultRowDetails(Type[] returnTypes, Object[] tuple) {
|
||||
if (!LOG.isTraceEnabled()) return;
|
||||
if ( tuple == null ) {
|
||||
LOG.nullTuple(returnTypes == null ? "null" : "Type[" + returnTypes.length + "]");
|
||||
if (returnTypes != null && returnTypes.length > 1) LOG.unexpectedNullTupleResult(returnTypes.length);
|
||||
LOG.trace(" tuple is null; returnTypes is " + returnTypes == null ? "null" : "Type[" + returnTypes.length + "]");
|
||||
if (returnTypes != null && returnTypes.length > 1) LOG.trace("Unexpected result tuple! tuple is null; should be Object["
|
||||
+ returnTypes.length + "]!");
|
||||
}
|
||||
else {
|
||||
if (returnTypes == null || returnTypes.length == 0) LOG.unexpectedNonNullTupleResult(returnTypes == null ? "null" : "empty");
|
||||
LOG.tupleAndReturnTypes(tuple.length, returnTypes.length);
|
||||
if (tuple.length != returnTypes.length) LOG.unexpectedTupleCount(returnTypes.length, tuple.length);
|
||||
if (returnTypes == null || returnTypes.length == 0) LOG.trace("Unexpected result tuple! tuple is null; returnTypes is "
|
||||
+ (returnTypes == null ? "null" : "empty"));
|
||||
LOG.trace(" tuple is Object[" + tuple.length + "]; returnTypes is Type[" + returnTypes.length + "]");
|
||||
if (tuple.length != returnTypes.length) LOG.trace("Unexpected tuple length! transformer= expected="
|
||||
+ returnTypes.length + " got=" + tuple.length);
|
||||
else for (int j = 0; j < tuple.length; j++) {
|
||||
if (tuple[j] != null && !returnTypes[j].getReturnedClass().isInstance(tuple[j])) LOG.unexpectedTupleValueType(returnTypes[j].getReturnedClass().getName(),
|
||||
tuple[j].getClass().getName());
|
||||
if (tuple[j] != null && !returnTypes[j].getReturnedClass().isInstance(tuple[j])) LOG.trace("Unexpected tuple value type! transformer= expected="
|
||||
+ returnTypes[j].getReturnedClass().getName()
|
||||
+ " got="
|
||||
+ tuple[j].getClass().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
package org.hibernate.cache;
|
||||
|
||||
import java.util.Comparator;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.cache.access.SoftLock;
|
||||
|
||||
/**
|
||||
|
@ -46,10 +47,10 @@ public class TransactionalCache implements CacheConcurrencyStrategy {
|
|||
}
|
||||
|
||||
public Object get(Object key, long txTimestamp) throws CacheException {
|
||||
LOG.lookup(key);
|
||||
LOG.debug("Cache lookup: " + key);
|
||||
Object result = cache.read( key );
|
||||
if (result == null) LOG.miss(key);
|
||||
else LOG.hit(key);
|
||||
if (result == null) LOG.debug("Cache miss: " + key);
|
||||
else LOG.debug("Cache hit: " + key);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -61,10 +62,10 @@ public class TransactionalCache implements CacheConcurrencyStrategy {
|
|||
Comparator versionComparator,
|
||||
boolean minimalPut) throws CacheException {
|
||||
if ( minimalPut && cache.read( key ) != null ) {
|
||||
LOG.exists(key);
|
||||
LOG.debug("Item already cached: " + key);
|
||||
return false;
|
||||
}
|
||||
LOG.caching(key);
|
||||
LOG.debug("Caching: " + key);
|
||||
if ( cache instanceof OptimisticCache ) {
|
||||
( ( OptimisticCache ) cache ).writeLoad( key, value, version );
|
||||
}
|
||||
|
@ -94,7 +95,7 @@ public class TransactionalCache implements CacheConcurrencyStrategy {
|
|||
Object value,
|
||||
Object currentVersion,
|
||||
Object previousVersion) throws CacheException {
|
||||
LOG.updating(key);
|
||||
LOG.debug("Updating: " + key);
|
||||
if ( cache instanceof OptimisticCache ) {
|
||||
( ( OptimisticCache ) cache ).writeUpdate( key, value, currentVersion, previousVersion );
|
||||
}
|
||||
|
@ -108,7 +109,7 @@ public class TransactionalCache implements CacheConcurrencyStrategy {
|
|||
Object key,
|
||||
Object value,
|
||||
Object currentVersion) throws CacheException {
|
||||
LOG.inserting(key);
|
||||
LOG.debug("Inserting: " + key);
|
||||
if ( cache instanceof OptimisticCache ) {
|
||||
( ( OptimisticCache ) cache ).writeInsert( key, value, currentVersion );
|
||||
}
|
||||
|
@ -123,12 +124,12 @@ public class TransactionalCache implements CacheConcurrencyStrategy {
|
|||
}
|
||||
|
||||
public void remove(Object key) throws CacheException {
|
||||
LOG.removing(key);
|
||||
LOG.debug("Removing: " + key);
|
||||
cache.remove( key );
|
||||
}
|
||||
|
||||
public void clear() throws CacheException {
|
||||
LOG.clearing();
|
||||
LOG.debug("Clearing");
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.util.Iterator;
|
|||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.cfg.Settings;
|
||||
|
||||
/**
|
||||
|
@ -43,7 +44,8 @@ import org.hibernate.cfg.Settings;
|
|||
*/
|
||||
public class UpdateTimestampsCache {
|
||||
public static final String REGION_NAME = UpdateTimestampsCache.class.getName();
|
||||
private static final Logger LOG = org.jboss.logging.Logger.getMessageLogger(Logger.class, Logger.class.getPackage().getName());
|
||||
private static final Logger LOG = org.jboss.logging.Logger.getMessageLogger(Logger.class,
|
||||
UpdateTimestampsCache.class.getPackage().getName());
|
||||
|
||||
private final TimestampsRegion region;
|
||||
|
||||
|
@ -58,7 +60,7 @@ public class UpdateTimestampsCache {
|
|||
//TODO: to handle concurrent writes correctly, this should return a Lock to the client
|
||||
Long ts = new Long( region.nextTimestamp() + region.getTimeout() );
|
||||
for ( int i=0; i<spaces.length; i++ ) {
|
||||
LOG.preInvalidatingSpace(spaces[i]);
|
||||
LOG.debug("Pre-invalidating space [" + spaces[i] + "]");
|
||||
//put() has nowait semantics, is this really appropriate?
|
||||
//note that it needs to be async replication, never local or sync
|
||||
region.put( spaces[i], ts );
|
||||
|
@ -71,7 +73,7 @@ public class UpdateTimestampsCache {
|
|||
Long ts = new Long( region.nextTimestamp() );
|
||||
//TODO: if lock.getTimestamp().equals(ts)
|
||||
for ( int i=0; i<spaces.length; i++ ) {
|
||||
LOG.invalidatingSpace(spaces[i], ts);
|
||||
LOG.debug("Invalidating space [" + spaces[i] + "], timestamp: " + ts);
|
||||
//put() has nowait semantics, is this really appropriate?
|
||||
//note that it needs to be async replication, never local or sync
|
||||
region.put( spaces[i], ts );
|
||||
|
@ -90,7 +92,7 @@ public class UpdateTimestampsCache {
|
|||
//result = false; // safer
|
||||
}
|
||||
else {
|
||||
LOG.spaceLastUpdated(space, lastUpdate, timestamp);
|
||||
LOG.debug("[" + space + "] last update timestamp: " + lastUpdate + ", result set timestamp: " + timestamp);
|
||||
if ( lastUpdate.longValue() >= timestamp.longValue() ) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
package org.hibernate.cache.impl.bridge;
|
||||
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.cache.Cache;
|
||||
import org.hibernate.cache.CacheConcurrencyStrategy;
|
||||
import org.hibernate.cache.CacheDataDescription;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
package org.hibernate.cache.impl.bridge;
|
||||
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.cache.Cache;
|
||||
import org.hibernate.cache.CacheConcurrencyStrategy;
|
||||
import org.hibernate.cache.CacheDataDescription;
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* JBoss, Home of Professional Open Source.
|
||||
*
|
||||
* See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing.
|
||||
*
|
||||
* See the AUTHORS.txt file distributed with this work for a full listing of individual contributors.
|
||||
*/
|
||||
package org.hibernate.cache.impl.bridge;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger {
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Cache provider: %s" )
|
||||
void cacheProvider( String name );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "read-only cache configured for mutable collection [%s]" )
|
||||
void readOnlyCacheConfiguredForMutableCollection( String name );
|
||||
}
|
|
@ -24,6 +24,7 @@
|
|||
package org.hibernate.cache.impl.bridge;
|
||||
|
||||
import java.util.Properties;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.cache.CacheDataDescription;
|
||||
import org.hibernate.cache.CacheException;
|
||||
import org.hibernate.cache.CacheProvider;
|
||||
|
@ -48,7 +49,8 @@ import org.hibernate.util.ReflectHelper;
|
|||
public class RegionFactoryCacheProviderBridge implements RegionFactory {
|
||||
public static final String DEF_PROVIDER = NoCacheProvider.class.getName();
|
||||
|
||||
private static final Logger LOG = org.jboss.logging.Logger.getMessageLogger(Logger.class, Logger.class.getPackage().getName());
|
||||
private static final Logger LOG = org.jboss.logging.Logger.getMessageLogger(Logger.class,
|
||||
RegionFactoryCacheProviderBridge.class.getPackage().getName());
|
||||
|
||||
private CacheProvider cacheProvider;
|
||||
private Settings settings;
|
||||
|
|
|
@ -23,10 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.cfg;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -87,6 +83,7 @@ import org.hibernate.AnnotationException;
|
|||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.BatchSize;
|
||||
import org.hibernate.annotations.Cache;
|
||||
|
@ -173,10 +170,6 @@ import org.hibernate.mapping.UnionSubclass;
|
|||
import org.hibernate.persister.entity.JoinedSubclassEntityPersister;
|
||||
import org.hibernate.persister.entity.SingleTableEntityPersister;
|
||||
import org.hibernate.persister.entity.UnionSubclassEntityPersister;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* JSR 175 annotation binder which reads the annotations from classes, applies the
|
||||
|
@ -272,7 +265,7 @@ public final class AnnotationBinder {
|
|||
SequenceGenerator ann = pckg.getAnnotation( SequenceGenerator.class );
|
||||
IdGenerator idGen = buildIdGenerator( ann, mappings );
|
||||
mappings.addGenerator( idGen );
|
||||
LOG.addSequenceGenerator(idGen.getName());
|
||||
LOG.trace("Add sequence generator with name: " + idGen.getName());
|
||||
}
|
||||
if ( pckg.isAnnotationPresent( TableGenerator.class ) ) {
|
||||
TableGenerator ann = pckg.getAnnotation( TableGenerator.class );
|
||||
|
@ -413,7 +406,7 @@ public final class AnnotationBinder {
|
|||
org.hibernate.id.enhanced.TableGenerator.INITIAL_PARAM,
|
||||
String.valueOf( tabGen.initialValue() + 1 )
|
||||
);
|
||||
if (tabGen.uniqueConstraints() != null && tabGen.uniqueConstraints().length > 0) LOG.tableGenerator(tabGen.name());
|
||||
if (tabGen.uniqueConstraints() != null && tabGen.uniqueConstraints().length > 0) LOG.warn(tabGen.name());
|
||||
}
|
||||
else {
|
||||
idGen.setIdentifierGeneratorStrategy( MultipleHiLoPerTableGenerator.class.getName() );
|
||||
|
@ -441,7 +434,7 @@ public final class AnnotationBinder {
|
|||
}
|
||||
idGen.addParam( TableHiLoGenerator.MAX_LO, String.valueOf( tabGen.allocationSize() - 1 ) );
|
||||
}
|
||||
LOG.addTableGenerator(idGen.getName());
|
||||
LOG.trace("Add table generator with name: " + idGen.getName());
|
||||
}
|
||||
else if ( ann instanceof SequenceGenerator ) {
|
||||
SequenceGenerator seqGen = ( SequenceGenerator ) ann;
|
||||
|
@ -471,7 +464,7 @@ public final class AnnotationBinder {
|
|||
// steve : or just use o.h.id.enhanced.SequenceStyleGenerator
|
||||
if (seqGen.initialValue() != 1) LOG.unsupportedInitialValue(Configuration.USE_NEW_ID_GENERATOR_MAPPINGS);
|
||||
idGen.addParam( SequenceHiLoGenerator.MAX_LO, String.valueOf( seqGen.allocationSize() - 1 ) );
|
||||
LOG.addSequenceGenerator(idGen.getName());
|
||||
LOG.trace("Add sequence generator with name: " + idGen.getName());
|
||||
}
|
||||
}
|
||||
else if ( ann instanceof GenericGenerator ) {
|
||||
|
@ -482,7 +475,7 @@ public final class AnnotationBinder {
|
|||
for ( Parameter parameter : params ) {
|
||||
idGen.addParam( parameter.name(), parameter.value() );
|
||||
}
|
||||
LOG.addGenericGenerator(idGen.getName());
|
||||
LOG.trace("Add generic generator with name: " + idGen.getName());
|
||||
}
|
||||
else {
|
||||
throw new AssertionFailure( "Unknown Generator annotation: " + ann );
|
||||
|
@ -996,7 +989,7 @@ public final class AnnotationBinder {
|
|||
SharedCacheMode mode;
|
||||
final Object value = mappings.getConfigurationProperties().get( "javax.persistence.sharedCache.mode" );
|
||||
if ( value == null ) {
|
||||
LOG.sharedCacheModeNotFound();
|
||||
LOG.debug("No value specified for 'javax.persistence.sharedCache.mode'; using UNSPECIFIED");
|
||||
mode = SharedCacheMode.UNSPECIFIED;
|
||||
}
|
||||
else {
|
||||
|
@ -1008,7 +1001,7 @@ public final class AnnotationBinder {
|
|||
mode = SharedCacheMode.valueOf( value.toString() );
|
||||
}
|
||||
catch ( Exception e ) {
|
||||
LOG.invalidSharedCacheMode(value, e);
|
||||
LOG.debug("Unable to resolve given mode name [" + value + "]; using UNSPECIFIED : " + e);
|
||||
mode = SharedCacheMode.UNSPECIFIED;
|
||||
}
|
||||
}
|
||||
|
@ -1024,24 +1017,24 @@ public final class AnnotationBinder {
|
|||
|
||||
static void prepareDefaultCacheConcurrencyStrategy(Properties properties) {
|
||||
if ( DEFAULT_CACHE_CONCURRENCY_STRATEGY != null ) {
|
||||
LOG.defaultCacheConcurrencyStrategyAlreadyDefined();
|
||||
LOG.trace("Default cache concurrency strategy already defined");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !properties.containsKey( Configuration.DEFAULT_CACHE_CONCURRENCY_STRATEGY ) ) {
|
||||
LOG.defaultCacheConcurrencyStrategyNotFound();
|
||||
LOG.trace("Given properties did not contain any default cache concurrency strategy setting");
|
||||
return;
|
||||
}
|
||||
|
||||
final String strategyName = properties.getProperty( Configuration.DEFAULT_CACHE_CONCURRENCY_STRATEGY );
|
||||
LOG.defaultCacheConcurrencyStrategyDiscovered(strategyName);
|
||||
LOG.trace("Discovered default cache concurrency strategy via config [" + strategyName + "]");
|
||||
CacheConcurrencyStrategy strategy = CacheConcurrencyStrategy.parse( strategyName );
|
||||
if ( strategy == null ) {
|
||||
LOG.defaultCacheConcurrencyStrategySpecifiedNothing();
|
||||
LOG.trace("Discovered default cache concurrency strategy specified nothing");
|
||||
return;
|
||||
}
|
||||
|
||||
LOG.defaultCacheConcurrencyStrategy(strategy.name());
|
||||
LOG.debug("Setting default cache concurrency strategy via config [" + strategy.name() + "]");
|
||||
DEFAULT_CACHE_CONCURRENCY_STRATEGY = strategy;
|
||||
}
|
||||
|
||||
|
@ -1136,7 +1129,7 @@ public final class AnnotationBinder {
|
|||
( Map<String, Join> ) null, ( PropertyHolder ) null, mappings
|
||||
);
|
||||
}
|
||||
LOG.subclassJoinedColumnsCreated();
|
||||
LOG.trace("Subclass joined column(s) created");
|
||||
}
|
||||
else {
|
||||
if (clazzToProcess.isAnnotationPresent(PrimaryKeyJoinColumns.class)
|
||||
|
@ -1326,7 +1319,7 @@ public final class AnnotationBinder {
|
|||
discriminatorColumn.linkWithValue( discrim );
|
||||
discrim.setTypeName( discriminatorColumn.getDiscriminatorTypeName() );
|
||||
rootClass.setPolymorphic( true );
|
||||
LOG.settingDiscriminator(rootClass.getEntityName());
|
||||
LOG.trace("Setting discriminator for entity " + rootClass.getEntityName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1445,7 +1438,7 @@ public final class AnnotationBinder {
|
|||
* ordering does not matter
|
||||
*/
|
||||
|
||||
LOG.processingAnnotations(propertyHolder.getEntityName(), inferredData.getPropertyName());
|
||||
LOG.trace("Processing annotations of " + propertyHolder.getEntityName() + "." + inferredData.getPropertyName());
|
||||
|
||||
final XProperty property = inferredData.getProperty();
|
||||
if ( property.isAnnotationPresent( Parent.class ) ) {
|
||||
|
@ -1509,7 +1502,7 @@ public final class AnnotationBinder {
|
|||
+ propertyHolder.getEntityName()
|
||||
);
|
||||
}
|
||||
LOG.versionProperty(inferredData.getPropertyName());
|
||||
LOG.trace(inferredData.getPropertyName() + " is a version property");
|
||||
RootClass rootClass = ( RootClass ) propertyHolder.getPersistentClass();
|
||||
propertyBinder.setColumns( columns );
|
||||
Property prop = propertyBinder.makePropertyValueAndBind();
|
||||
|
@ -1533,7 +1526,8 @@ public final class AnnotationBinder {
|
|||
SimpleValue simpleValue = ( SimpleValue ) prop.getValue();
|
||||
simpleValue.setNullValue( "undefined" );
|
||||
rootClass.setOptimisticLockMode( Versioning.OPTIMISTIC_LOCK_VERSION );
|
||||
LOG.version(rootClass.getVersion().getName(), ((SimpleValue)rootClass.getVersion().getValue()).getNullValue());
|
||||
LOG.trace("Version name: " + rootClass.getVersion().getName() + ", unsavedValue: "
|
||||
+ ((SimpleValue)rootClass.getVersion().getValue()).getNullValue());
|
||||
}
|
||||
else {
|
||||
final boolean forcePersist = property.isAnnotationPresent( MapsId.class )
|
||||
|
@ -2141,7 +2135,7 @@ public final class AnnotationBinder {
|
|||
} //a component must not have any generator
|
||||
BinderHelper.makeIdGenerator( idValue, generatorType, generatorName, mappings, localGenerators );
|
||||
|
||||
LOG.bindAnnotationToProperty((isComponent ? "@EmbeddedId" : "@Id"), inferredData.getPropertyName());
|
||||
LOG.trace("Bind " + (isComponent ? "@EmbeddedId" : "@Id") + " on " + inferredData.getPropertyName());
|
||||
}
|
||||
|
||||
//TODO move that to collection binder?
|
||||
|
@ -2323,7 +2317,7 @@ public final class AnnotationBinder {
|
|||
*/
|
||||
Component comp = createComponent( propertyHolder, inferredData, isComponentEmbedded, isIdentifierMapper, mappings );
|
||||
String subpath = BinderHelper.getPath( propertyHolder, inferredData );
|
||||
LOG.bindingComponent(subpath);
|
||||
LOG.trace("Binding component with path: " + subpath);
|
||||
PropertyHolder subHolder = PropertyHolderBuilder.buildPropertyHolder(
|
||||
comp, subpath,
|
||||
inferredData, propertyHolder, mappings
|
||||
|
@ -2752,7 +2746,7 @@ public final class AnnotationBinder {
|
|||
Mappings mappings) {
|
||||
//column.getTable() => persistentClass.getTable()
|
||||
final String propertyName = inferredData.getPropertyName();
|
||||
LOG.fetching(propertyName, fetchMode);
|
||||
LOG.trace("Fetching " + propertyName + " with " + fetchMode);
|
||||
boolean mapToPK = true;
|
||||
if ( !trueOneToOne ) {
|
||||
//try to find a hidden true one to one (FK == PK columns)
|
||||
|
@ -3075,144 +3069,4 @@ public final class AnnotationBinder {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Add generic generator with name: %s" )
|
||||
void addGenericGenerator( String name );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Add sequence generator with name: %s" )
|
||||
void addSequenceGenerator( String name );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Add table generator with name: %s" )
|
||||
void addTableGenerator( String name );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Bind %s on %s" )
|
||||
void bindAnnotationToProperty( String annotation,
|
||||
String propertyName );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Binding component with path: %s" )
|
||||
void bindingComponent( String subpath );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Binding entity from annotated class: %s" )
|
||||
void bindingEntityFromClass( String className );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Binding filter definition: %s" )
|
||||
void bindingFilterDefinition( String name );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Binding type definition: %s" )
|
||||
void bindingTypeDefinition( String name );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Setting default cache concurrency strategy via config [%s]" )
|
||||
void defaultCacheConcurrencyStrategy( String strategy );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Default cache concurrency strategy already defined" )
|
||||
void defaultCacheConcurrencyStrategyAlreadyDefined();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Discovered default cache concurrency strategy via config [%s]" )
|
||||
void defaultCacheConcurrencyStrategyDiscovered( String strategy );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Given properties did not contain any default cache concurrency strategy setting" )
|
||||
void defaultCacheConcurrencyStrategyNotFound();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Discovered default cache concurrency strategy specified nothing" )
|
||||
void defaultCacheConcurrencyStrategySpecifiedNothing();
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "@ForceDiscriminator is deprecated use @DiscriminatorOptions instead." )
|
||||
void deprecatedForceDescriminatorAnnotation();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Fetching %s with %s" )
|
||||
void fetching( String propertyName,
|
||||
FetchMode fetchMode );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Ignoring unique constraints specified on table generator [%s]" )
|
||||
void ignoringTableGeneratorConstraints(String name);
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Discriminator column has to be defined in the root entity, it will be ignored in subclass: %s" )
|
||||
void invalidDescriminatorAnnotation( String className );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Inapropriate use of @OnDelete on entity, annotation ignored: %s" )
|
||||
void invalidOnDeleteAnnotation( String entityName );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Root entity should not hold an PrimaryKeyJoinColum(s), will be ignored" )
|
||||
void invalidPrimaryKeyJoinColumnAnnotation();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Unable to resolve given mode name [%s]; using UNSPECIFIED : %s" )
|
||||
void invalidSharedCacheMode( Object value,
|
||||
Exception error );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Mixing inheritance strategy in a entity hierarchy is not allowed, ignoring sub strategy in: %s" )
|
||||
void invalidSubStrategy( String className );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Illegal use of @Table in a subclass of a SINGLE_TABLE hierarchy: %s" )
|
||||
void invalidTableAnnotation( String className );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Class annotated @org.hibernate.annotations.Entity but not javax.persistence.Entity (most likely a user error): %s" )
|
||||
void missingEntityAnnotation( String className );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Package not found or wo package-info.java: %s" )
|
||||
void packageNotFound( String packageName );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Processing annotations of %s.%s" )
|
||||
void processingAnnotations( String entityName,
|
||||
String propertyName );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Setting discriminator for entity %s" )
|
||||
void settingDiscriminator( String entityName );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "No value specified for 'javax.persistence.sharedCache.mode'; using UNSPECIFIED" )
|
||||
void sharedCacheModeNotFound();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Subclass joined column(s) created" )
|
||||
void subclassJoinedColumnsCreated();
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "%s" )
|
||||
void tableGenerator( String name );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Hibernate does not support SequenceGenerator.initialValue() unless '%s' set" )
|
||||
void unsupportedInitialValue( String propertyName );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Version name: %s, unsavedValue: %s" )
|
||||
void version( String name,
|
||||
String nullValue );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "%s is a version property" )
|
||||
void versionProperty( String propertyName );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.cfg;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
@ -36,6 +35,7 @@ import java.util.Set;
|
|||
import java.util.StringTokenizer;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.AnyMetaDef;
|
||||
import org.hibernate.annotations.AnyMetaDefs;
|
||||
|
@ -63,10 +63,6 @@ import org.hibernate.mapping.Table;
|
|||
import org.hibernate.mapping.ToOne;
|
||||
import org.hibernate.mapping.Value;
|
||||
import org.hibernate.util.StringHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
|
@ -691,20 +687,7 @@ public class BinderHelper {
|
|||
}
|
||||
return pd;
|
||||
}
|
||||
else {
|
||||
String propertyPath = isId ? "" : propertyName;
|
||||
return mappings.getPropertyAnnotatedWithMapsId( persistentXClass, propertyPath );
|
||||
}
|
||||
String propertyPath = isId ? "" : propertyName;
|
||||
return mappings.getPropertyAnnotatedWithMapsId(persistentXClass, propertyPath);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Binding Any Meta definition: %s" )
|
||||
void bindingAnyMetaDefinition( String name );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,20 +23,16 @@
|
|||
*/
|
||||
package org.hibernate.cfg;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.mapping.Collection;
|
||||
import org.hibernate.mapping.IndexedCollection;
|
||||
import org.hibernate.mapping.OneToMany;
|
||||
import org.hibernate.mapping.Selectable;
|
||||
import org.hibernate.mapping.Value;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Collection second pass
|
||||
|
@ -64,7 +60,7 @@ public abstract class CollectionSecondPass implements SecondPass {
|
|||
|
||||
public void doSecondPass(java.util.Map persistentClasses)
|
||||
throws MappingException {
|
||||
LOG.secondPass(collection.getRole());
|
||||
LOG.debug("Second pass for collection: " + collection.getRole());
|
||||
|
||||
secondPass( persistentClasses, localInheritedMetas ); // using local since the inheritedMetas at this point is not the correct map since it is always the empty map
|
||||
collection.createAllKeys();
|
||||
|
@ -80,7 +76,7 @@ public abstract class CollectionSecondPass implements SecondPass {
|
|||
else {
|
||||
msg += ", element: " + columns( collection.getElement() );
|
||||
}
|
||||
LOG.mappedCollection(msg);
|
||||
LOG.debug(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,19 +92,4 @@ public abstract class CollectionSecondPass implements SecondPass {
|
|||
}
|
||||
return columns.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "%s" )
|
||||
void mappedCollection( String message );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Second pass for collection: %s" )
|
||||
void secondPass( String role );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,11 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.cfg;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.ERROR;
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
|
@ -175,10 +170,6 @@ import org.hibernate.util.xml.Origin;
|
|||
import org.hibernate.util.xml.OriginImpl;
|
||||
import org.hibernate.util.xml.XmlDocument;
|
||||
import org.hibernate.util.xml.XmlDocumentImpl;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
import org.xml.sax.EntityResolver;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
|
@ -586,7 +577,7 @@ public class Configuration implements Serializable {
|
|||
XmlDocument metadataXml = add( inputSource, "file", name );
|
||||
|
||||
try {
|
||||
LOG.writingCacheFile(xmlFile, cachedFile);
|
||||
LOG.debug("Writing cache file for: " + xmlFile + " to: " + cachedFile);
|
||||
SerializationHelper.serialize( ( Serializable ) metadataXml.getDocumentTree(), new FileOutputStream( cachedFile ) );
|
||||
} catch (Exception e) {
|
||||
LOG.unableToWriteCachedFile(cachedFile.getPath(), e.getMessage());
|
||||
|
@ -653,7 +644,7 @@ public class Configuration implements Serializable {
|
|||
* given XML string
|
||||
*/
|
||||
public Configuration addXML(String xml) throws MappingException {
|
||||
LOG.mappingXml(xml);
|
||||
LOG.debug("Mapping XML:\n" + xml);
|
||||
final InputSource inputSource = new InputSource( new StringReader( xml ) );
|
||||
add( inputSource, "string", "XML String" );
|
||||
return this;
|
||||
|
@ -670,7 +661,7 @@ public class Configuration implements Serializable {
|
|||
public Configuration addURL(URL url) throws MappingException {
|
||||
final String urlExternalForm = url.toExternalForm();
|
||||
|
||||
LOG.readingMappingDocument(urlExternalForm);
|
||||
LOG.debug("Reading mapping document from URL : " + urlExternalForm);
|
||||
|
||||
try {
|
||||
add( url.openStream(), "URL", urlExternalForm );
|
||||
|
@ -691,7 +682,7 @@ public class Configuration implements Serializable {
|
|||
inputStream.close();
|
||||
}
|
||||
catch ( IOException ignore ) {
|
||||
LOG.unableToCloseInputStream();
|
||||
LOG.trace("Was unable to close input stream");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -705,7 +696,7 @@ public class Configuration implements Serializable {
|
|||
* the mapping document.
|
||||
*/
|
||||
public Configuration addDocument(org.w3c.dom.Document doc) throws MappingException {
|
||||
LOG.mappingDocument(doc);
|
||||
LOG.debug("Mapping Document:\n" + doc);
|
||||
|
||||
final Document document = xmlHelper.createDOMReader().read( doc );
|
||||
add( new XmlDocumentImpl( document, "unknown", null ) );
|
||||
|
@ -1345,7 +1336,7 @@ public class Configuration implements Serializable {
|
|||
}
|
||||
|
||||
protected void secondPassCompile() throws MappingException {
|
||||
LOG.startingSecondPassCompile();
|
||||
LOG.trace("Starting secondPassCompile() processing");
|
||||
|
||||
//process default values first
|
||||
{
|
||||
|
@ -1432,7 +1423,7 @@ public class Configuration implements Serializable {
|
|||
* an entity having a PK made of a ManyToOne ...).
|
||||
*/
|
||||
private void processFkSecondPassInOrder() {
|
||||
LOG.processingForeignKeyMappings();
|
||||
LOG.debug("Processing fk mappings (*ToOne and JoinedSubclass)");
|
||||
List<FkSecondPass> fkSecondPasses = getFKSecondPassesOnly();
|
||||
|
||||
if ( fkSecondPasses.size() == 0 ) {
|
||||
|
@ -1672,10 +1663,10 @@ public class Configuration implements Serializable {
|
|||
}
|
||||
|
||||
private void originalSecondPassCompile() throws MappingException {
|
||||
LOG.processingExtendsQueue();
|
||||
LOG.debug("Processing extends queue");
|
||||
processExtendsQueue();
|
||||
|
||||
LOG.processingCollectionMappings();
|
||||
LOG.debug("Processing collection mappings");
|
||||
Iterator itr = secondPasses.iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
SecondPass sp = (SecondPass) itr.next();
|
||||
|
@ -1685,7 +1676,7 @@ public class Configuration implements Serializable {
|
|||
}
|
||||
}
|
||||
|
||||
LOG.processingNativeQuery();
|
||||
LOG.debug("Processing native query and ResultSetMapping mappings");
|
||||
itr = secondPasses.iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
SecondPass sp = (SecondPass) itr.next();
|
||||
|
@ -1693,7 +1684,7 @@ public class Configuration implements Serializable {
|
|||
itr.remove();
|
||||
}
|
||||
|
||||
LOG.processingAssociationPropertyReferences();
|
||||
LOG.debug("Processing association property references");
|
||||
|
||||
itr = propertyReferences.iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
|
@ -1715,7 +1706,7 @@ public class Configuration implements Serializable {
|
|||
|
||||
//TODO: Somehow add the newly created foreign keys to the internal collection
|
||||
|
||||
LOG.processingForeignKeyConstraints();
|
||||
LOG.debug("Processing foreign key constraints");
|
||||
|
||||
itr = getTableMappings();
|
||||
Set done = new HashSet();
|
||||
|
@ -1726,7 +1717,7 @@ public class Configuration implements Serializable {
|
|||
}
|
||||
|
||||
private int processExtendsQueue() {
|
||||
LOG.processingExtendsQueue();
|
||||
LOG.debug("Processing extends queue");
|
||||
int added = 0;
|
||||
ExtendsQueueEntry extendsQueueEntry = findPossibleExtends();
|
||||
while ( extendsQueueEntry != null ) {
|
||||
|
@ -1783,7 +1774,7 @@ public class Configuration implements Serializable {
|
|||
" does not specify the referenced entity"
|
||||
);
|
||||
}
|
||||
LOG.resolvingReference(referencedEntityName);
|
||||
LOG.debug("Resolving reference to class: " + referencedEntityName);
|
||||
PersistentClass referencedClass = classes.get( referencedEntityName );
|
||||
if ( referencedClass == null ) {
|
||||
throw new MappingException(
|
||||
|
@ -1857,7 +1848,7 @@ public class Configuration implements Serializable {
|
|||
}
|
||||
catch ( ClassNotFoundException e ) {
|
||||
//validator is not present
|
||||
LOG.legacyValidatorNotFound();
|
||||
LOG.debug("Legacy Validator not present in classpath, ignoring event listener registration");
|
||||
}
|
||||
if ( enableValidatorListeners && validateEventListenerClass != null ) {
|
||||
//TODO so much duplication
|
||||
|
@ -1940,7 +1931,7 @@ public class Configuration implements Serializable {
|
|||
searchStartupClass = ReflectHelper.classForName( SEARCH_EVENT_LISTENER_REGISTERER_CLASS, getClass() );
|
||||
}
|
||||
catch ( ClassNotFoundException cnfe ) {
|
||||
LOG.searchNotFound();
|
||||
LOG.debug("Search not present in classpath, ignoring event listener registration.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1956,16 +1947,16 @@ public class Configuration implements Serializable {
|
|||
enableSearchMethod.invoke( searchStartupInstance, getEventListeners(), getProperties() );
|
||||
}
|
||||
catch ( InstantiationException e ) {
|
||||
LOG.unableToInstantiate(SEARCH_STARTUP_CLASS);
|
||||
LOG.debug("Unable to instantiate " + SEARCH_STARTUP_CLASS + ", ignoring event listener registration.");
|
||||
}
|
||||
catch ( IllegalAccessException e ) {
|
||||
LOG.unableToInstantiate(SEARCH_STARTUP_CLASS);
|
||||
LOG.debug("Unable to instantiate " + SEARCH_STARTUP_CLASS + ", ignoring event listener registration.");
|
||||
}
|
||||
catch ( NoSuchMethodException e ) {
|
||||
LOG.methodNotFound(SEARCH_STARTUP_METHOD, SEARCH_STARTUP_CLASS);
|
||||
LOG.debug("Method " + SEARCH_STARTUP_METHOD + "() not found in " + SEARCH_STARTUP_CLASS);
|
||||
}
|
||||
catch ( InvocationTargetException e ) {
|
||||
LOG.unableToExecute(SEARCH_STARTUP_METHOD);
|
||||
LOG.debug("Unable to execute " + SEARCH_STARTUP_METHOD + ", ignoring event listener registration.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2079,7 +2070,7 @@ public class Configuration implements Serializable {
|
|||
Element node = (Element) itr.next();
|
||||
String name = node.attributeValue( "name" );
|
||||
String value = node.getText().trim();
|
||||
LOG.attribute(name, value);
|
||||
LOG.debug(name + "=" + value);
|
||||
properties.setProperty( name, value );
|
||||
if ( !name.startsWith( "hibernate" ) ) {
|
||||
properties.setProperty( "hibernate." + name, value );
|
||||
|
@ -2259,7 +2250,7 @@ public class Configuration implements Serializable {
|
|||
}
|
||||
|
||||
LOG.configuredSessionFactory(name);
|
||||
LOG.properties(properties);
|
||||
LOG.debug("Properties: " + properties);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
@ -2304,27 +2295,27 @@ public class Configuration implements Serializable {
|
|||
|
||||
if ( resourceAttribute != null ) {
|
||||
final String resourceName = resourceAttribute.getValue();
|
||||
LOG.sessionFactoryConfigResourceForMapping(name, resourceName);
|
||||
LOG.debug("Session-factory config [" + name + "] named resource [" + resourceName + "] for mapping");
|
||||
addResource( resourceName );
|
||||
}
|
||||
else if ( fileAttribute != null ) {
|
||||
final String fileName = fileAttribute.getValue();
|
||||
LOG.sessionFactoryConfigFileForMapping(name, fileName);
|
||||
LOG.debug("Session-factory config [" + name + "] named file [" + fileName + "] for mapping");
|
||||
addFile( fileName );
|
||||
}
|
||||
else if ( jarAttribute != null ) {
|
||||
final String jarFileName = jarAttribute.getValue();
|
||||
LOG.sessionFactoryConfigJarForMapping(name, jarFileName);
|
||||
LOG.debug("Session-factory config [" + name + "] named jar file [" + jarFileName + "] for mapping");
|
||||
addJar( new File( jarFileName ) );
|
||||
}
|
||||
else if ( packageAttribute != null ) {
|
||||
final String packageName = packageAttribute.getValue();
|
||||
LOG.sessionFactoryConfigPackageForMapping(name, packageName);
|
||||
LOG.debug("Session-factory config [" + name + "] named package [" + packageName + "] for mapping");
|
||||
addPackage( packageName );
|
||||
}
|
||||
else if ( classAttribute != null ) {
|
||||
final String className = classAttribute.getValue();
|
||||
LOG.sessionFactoryConfigClassForMapping(name, className);
|
||||
LOG.debug("Session-factory config [" + name + "] named class [" + className + "] for mapping");
|
||||
|
||||
try {
|
||||
addAnnotatedClass( ReflectHelper.classForName( className ) );
|
||||
|
@ -2367,7 +2358,7 @@ public class Configuration implements Serializable {
|
|||
for ( int i = 0; i < listeners.size() ; i++ ) {
|
||||
listenerClasses[i] = ( (Element) listeners.get( i ) ).attributeValue( "class" );
|
||||
}
|
||||
LOG.eventListeners(type, StringHelper.toString(listenerClasses));
|
||||
LOG.debug("Event listeners: " + type + "=" + StringHelper.toString(listenerClasses));
|
||||
setListeners( type, listenerClasses );
|
||||
}
|
||||
|
||||
|
@ -2377,7 +2368,7 @@ public class Configuration implements Serializable {
|
|||
throw new MappingException( "No type specified for listener" );
|
||||
}
|
||||
String impl = element.attributeValue( "class" );
|
||||
LOG.eventListener(type, impl);
|
||||
LOG.debug("Event listener: " + type + "=" + impl);
|
||||
setListeners( type, new String[]{impl} );
|
||||
}
|
||||
|
||||
|
@ -3290,7 +3281,7 @@ public class Configuration implements Serializable {
|
|||
public void addTypeDef(String typeName, String typeClass, Properties paramMap) {
|
||||
TypeDef def = new TypeDef( typeClass, paramMap );
|
||||
typeDefs.put( typeName, def );
|
||||
LOG.addedType(typeName, typeClass);
|
||||
LOG.debug("Added " + typeName + " with class " + typeClass);
|
||||
}
|
||||
|
||||
public Map getFilterDefinitions() {
|
||||
|
@ -3914,7 +3905,7 @@ public class Configuration implements Serializable {
|
|||
}
|
||||
|
||||
private void processHbmXmlQueue() {
|
||||
LOG.processingHbmFiles();
|
||||
LOG.debug("Processing hbm.xml files");
|
||||
for ( Map.Entry<XmlDocument, Set<String>> entry : hbmMetadataToEntityNamesMap.entrySet() ) {
|
||||
// Unfortunately we have to create a Mappings instance for each iteration here
|
||||
processHbmXml( entry.getKey(), entry.getValue() );
|
||||
|
@ -3944,7 +3935,7 @@ public class Configuration implements Serializable {
|
|||
}
|
||||
|
||||
private void processAnnotatedClassesQueue() {
|
||||
LOG.processAnnotatedClasses();
|
||||
LOG.debug("Process annotated classes");
|
||||
//bind classes in the correct order calculating some inheritance state
|
||||
List<XClass> orderedClasses = orderAndFillHierarchy( annotatedClasses );
|
||||
Mappings mappings = createMappings();
|
||||
|
@ -4067,256 +4058,4 @@ public class Configuration implements Serializable {
|
|||
public boolean isClass;
|
||||
public boolean cacheLazy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Added %s with class %s" )
|
||||
void addedType( String typeName,
|
||||
String typeClass );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "%s=%s" )
|
||||
void attribute( String name,
|
||||
String value );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Preparing to build session factory with filters : %s" )
|
||||
void buildingSessionFactory( Map<String, FilterDefinition> filterDefinitions );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "I/O reported cached file could not be found : %s : %s" )
|
||||
void cachedFileNotFound( String path,
|
||||
FileNotFoundException error );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Configuration resource: %s" )
|
||||
void configurationResource( String resource );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Configured SessionFactory: %s" )
|
||||
void configuredSessionFactory( String name );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Configuring from file: %s" )
|
||||
void configuringFromFile( String file );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Configuring from resource: %s" )
|
||||
void configuringFromResource( String resource );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Configuring from URL: %s" )
|
||||
void configuringFromUrl( URL url );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Configuring from XML document" )
|
||||
void configuringFromXmlDocument();
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Duplicate generator name %s" )
|
||||
void duplicateGeneratorName( String name );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Duplicate generator table: %s" )
|
||||
void duplicateGeneratorTable( String name );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Duplicate import: %s -> %s" )
|
||||
void duplicateImport( String entityName,
|
||||
String rename );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Duplicate joins for class: %s" )
|
||||
void duplicateJoins( String entityName );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Event listener: %s=%s" )
|
||||
void eventListener( String type,
|
||||
String className );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Event listeners: %s=%s" )
|
||||
void eventListeners( String type,
|
||||
String listenerClasses );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Found mapping document in jar: %s" )
|
||||
void foundMappingDocument( String name );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Mapping metadata cache was not completely processed" )
|
||||
void incompleteMappingMetadataCacheProcessing();
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "JACC contextID: %s" )
|
||||
void jaccContextId( String contextId );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Legacy Validator not present in classpath, ignoring event listener registration" )
|
||||
void legacyValidatorNotFound();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Mapping Document:\n%s" )
|
||||
void mappingDocument( org.w3c.dom.Document document );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Mapping Package %s" )
|
||||
void mappingPackage( String packageName );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Mapping XML:\n%s" )
|
||||
void mappingXml( String xml );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Method %s() not found in %s" )
|
||||
void methodNotFound( String searchStartupMethod,
|
||||
String searchStartupClass );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Process annotated classes" )
|
||||
void processAnnotatedClasses();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Processing association property references" )
|
||||
void processingAssociationPropertyReferences();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Processing collection mappings" )
|
||||
void processingCollectionMappings();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Processing extends queue" )
|
||||
void processingExtendsQueue();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Processing foreign key constraints" )
|
||||
void processingForeignKeyConstraints();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Processing fk mappings (*ToOne and JoinedSubclass)" )
|
||||
void processingForeignKeyMappings();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Processing hbm.xml files" )
|
||||
void processingHbmFiles();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Processing native query and ResultSetMapping mappings" )
|
||||
void processingNativeQuery();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Properties: %s" )
|
||||
void properties( Properties properties );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Reading mappings from cache file: %s" )
|
||||
void readingCachedMappings( File cachedFile );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Reading mapping document from URL : %s" )
|
||||
void readingMappingDocument( String urlExternalForm );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Reading mappings from file: %s" )
|
||||
void readingMappingsFromFile( String path );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Reading mappings from resource: %s" )
|
||||
void readingMappingsFromResource( String resourceName );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Resolving reference to class: %s" )
|
||||
void resolvingReference( String referencedEntityName );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Searching for mapping documents in jar: %s" )
|
||||
void searchingForMappingDocuments( String name );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Search not present in classpath, ignoring event listener registration." )
|
||||
void searchNotFound();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Session-factory config [%s] named class [%s] for mapping" )
|
||||
void sessionFactoryConfigClassForMapping( String configName,
|
||||
String name );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Session-factory config [%s] named file [%s] for mapping" )
|
||||
void sessionFactoryConfigFileForMapping( String configName,
|
||||
String name );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Session-factory config [%s] named jar file [%s] for mapping" )
|
||||
void sessionFactoryConfigJarForMapping( String configName,
|
||||
String name );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Session-factory config [%s] named package [%s] for mapping" )
|
||||
void sessionFactoryConfigPackageForMapping( String configName,
|
||||
String name );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Session-factory config [%s] named resource [%s] for mapping" )
|
||||
void sessionFactoryConfigResourceForMapping( String configName,
|
||||
String name );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting secondPassCompile() processing" )
|
||||
void startingSecondPassCompile();
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Unable to apply constraints on DDL for %s : %s" )
|
||||
void unableToApplyConstraints( String className,
|
||||
String message );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Was unable to close input stream" )
|
||||
void unableToCloseInputStream();
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Could not close input stream for %s : %s" )
|
||||
void unableToCloseInputStream( String resourceName,
|
||||
String message );
|
||||
|
||||
@LogMessage( level = ERROR )
|
||||
@Message( value = "Could not close jar: %s" )
|
||||
void unableToCloseJar( String message );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Could not deserialize cache file: %s : %s" )
|
||||
void unableToDeserializeCache( String path,
|
||||
SerializationException error );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Unable to execute %s, ignoring event listener registration." )
|
||||
void unableToExecute( String searchStartupMethod );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Unable to instantiate %s, ignoring event listener registration." )
|
||||
void unableToInstantiate( String searchStartupClass );
|
||||
|
||||
@LogMessage( level = ERROR )
|
||||
@Message( value = "Could not parse the package-level metadata [%s]" )
|
||||
void unableToParseMetadata( String packageName );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "I/O reported error writing cached file : %s: %s" )
|
||||
void unableToWriteCachedFile( String path,
|
||||
String message );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Hibernate Validator not found: ignoring" )
|
||||
void validatorNotFound();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Writing cache file for: %s to: %s" )
|
||||
void writingCacheFile( File xmlFile,
|
||||
File cachedFile );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,13 +23,9 @@
|
|||
*/
|
||||
package org.hibernate.cfg;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import java.io.InputStream;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.util.DTDEntityResolver;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
import org.xml.sax.EntityResolver;
|
||||
import org.xml.sax.InputSource;
|
||||
|
||||
|
@ -56,7 +52,7 @@ public class EJB3DTDEntityResolver extends DTDEntityResolver {
|
|||
|
||||
@Override
|
||||
public InputSource resolveEntity(String publicId, String systemId) {
|
||||
LOG.resolvingXmlEntity(publicId, systemId);
|
||||
LOG.trace("Resolving XML entity " + publicId + " : " + systemId);
|
||||
InputSource is = super.resolveEntity( publicId, systemId );
|
||||
if ( is == null ) {
|
||||
if ( systemId != null ) {
|
||||
|
@ -92,10 +88,10 @@ public class EJB3DTDEntityResolver extends DTDEntityResolver {
|
|||
|
||||
private InputSource buildInputSource(String publicId, String systemId, InputStream dtdStream, boolean resolved) {
|
||||
if ( dtdStream == null ) {
|
||||
LOG.unableToLocate(systemId);
|
||||
LOG.trace("Unable to locate [" + systemId + "] on classpath");
|
||||
return null;
|
||||
}
|
||||
LOG.located(systemId);
|
||||
LOG.trace("Located [" + systemId + "] in classpath");
|
||||
InputSource source = new InputSource(dtdStream);
|
||||
source.setPublicId(publicId);
|
||||
source.setSystemId(systemId);
|
||||
|
@ -104,33 +100,9 @@ public class EJB3DTDEntityResolver extends DTDEntityResolver {
|
|||
}
|
||||
|
||||
private InputStream getStreamFromClasspath(String fileName) {
|
||||
LOG.resolvingFileName();
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Located [%s] in classpath" )
|
||||
void located( String systemId );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Recognized JPA ORM namespace; attempting to resolve on classpath under org/hibernate/ejb" )
|
||||
void resolvingFileName();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Resolving XML entity %s : %s" )
|
||||
void resolvingXmlEntity( String publicId,
|
||||
String systemId );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Unable to locate [%s] on classpath" )
|
||||
void unableToLocate( String systemId );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,10 +23,10 @@
|
|||
*/
|
||||
package org.hibernate.cfg;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import java.util.Map;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.annotations.ColumnTransformer;
|
||||
import org.hibernate.annotations.ColumnTransformers;
|
||||
import org.hibernate.annotations.Index;
|
||||
|
@ -38,10 +38,6 @@ import org.hibernate.mapping.Join;
|
|||
import org.hibernate.mapping.SimpleValue;
|
||||
import org.hibernate.mapping.Table;
|
||||
import org.hibernate.util.StringHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Wrap state of an EJB3 @Column annotation
|
||||
|
@ -186,7 +182,7 @@ public class Ejb3Column {
|
|||
|
||||
public void bind() {
|
||||
if ( StringHelper.isNotEmpty( formulaString ) ) {
|
||||
LOG.bindingFormula(formulaString);
|
||||
LOG.debug("Binding formula " + formulaString);
|
||||
formula = new Formula();
|
||||
formula.setFormula( formulaString );
|
||||
}
|
||||
|
@ -194,7 +190,7 @@ public class Ejb3Column {
|
|||
initMappingColumn(
|
||||
logicalColumnName, propertyName, length, precision, scale, nullable, sqlType, unique, true
|
||||
);
|
||||
LOG.bindingColumn(toString());
|
||||
LOG.debug("Binding column: " + toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -425,7 +421,7 @@ public class Ejb3Column {
|
|||
throw new AnnotationException( "AttributeOverride.column() should override all columns for now" );
|
||||
}
|
||||
actualCols = overriddenCols.length == 0 ? null : overriddenCols;
|
||||
LOG.columnsOverridden(inferredData.getPropertyName());
|
||||
LOG.debug("Column(s) overridden for property " + inferredData.getPropertyName());
|
||||
}
|
||||
if ( actualCols == null ) {
|
||||
columns = buildImplicitColumn(
|
||||
|
@ -631,23 +627,4 @@ public class Ejb3Column {
|
|||
sb.append( '}' );
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Binding column: %s" )
|
||||
void bindingColumn( String column );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Binding formula %s" )
|
||||
void bindingFormula( String formula );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Column(s) overridden for property %s" )
|
||||
void columnsOverridden( String propertyName );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.cfg;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.ERROR;
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.sql.Connection;
|
||||
|
@ -36,14 +33,11 @@ import java.util.Iterator;
|
|||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.Version;
|
||||
import org.hibernate.bytecode.BytecodeProvider;
|
||||
import org.hibernate.internal.util.config.ConfigurationHelper;
|
||||
import org.hibernate.util.ConfigHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -812,81 +806,4 @@ public final class Environment {
|
|||
LOG.unknownBytecodeProvider(providerName);
|
||||
return new org.hibernate.bytecode.javassist.BytecodeProviderImpl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Bytecode provider name : %s" )
|
||||
void bytecodeProvider( String provider );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "JVM does not support Statement.getGeneratedKeys()" )
|
||||
void generatedKeysNotSupported();
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "JVM does not support LinkedHashMap, LinkedHashSet - ordered maps and sets disabled" )
|
||||
void linkedMapsAndSetsNotSupported();
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Loaded properties from resource hibernate.properties: %s" )
|
||||
void propertiesLoaded( Properties maskOut );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "hibernate.properties not found" )
|
||||
void propertiesNotFound();
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Property [%s] has been renamed to [%s]; update your properties appropriately" )
|
||||
void renamedProperty( Object propertyName,
|
||||
Object newPropertyName );
|
||||
|
||||
@LogMessage( level = ERROR )
|
||||
@Message( value = "Could not close stream on hibernate.properties: %s" )
|
||||
void unableToCloseStream( IOException error );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Could not copy system properties, system properties will be ignored" )
|
||||
void unableToCopySystemProperties();
|
||||
|
||||
@LogMessage( level = ERROR )
|
||||
@Message( value = "Problem loading properties from hibernate.properties" )
|
||||
void unableToloadProperties();
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "unrecognized bytecode provider [%s], using javassist by default" )
|
||||
void unknownBytecodeProvider( String providerName );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Usage of obsolete property: %s no longer supported, use: %s" )
|
||||
void unsupportedProperty( Object propertyName,
|
||||
Object newPropertyName );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Using JDK 1.4 java.sql.Timestamp handling" )
|
||||
void usingJdk14TimestampHandling();
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Using pre JDK 1.4 java.sql.Timestamp handling" )
|
||||
void usingPreJdk14TimestampHandling();
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Using bytecode reflection optimizer" )
|
||||
void usingReflectionOptimizer();
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Using java.io streams to persist binary types" )
|
||||
void usingStreams();
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Using workaround for JVM bug in java.sql.Timestamp" )
|
||||
void usingTimestampWorkaround();
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Hibernate %s" )
|
||||
void version( String versionString );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.cfg;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -39,6 +36,7 @@ import org.hibernate.CacheMode;
|
|||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.engine.ExecuteUpdateResultCheckStyle;
|
||||
import org.hibernate.engine.FilterDefinition;
|
||||
|
@ -99,10 +97,6 @@ import org.hibernate.util.JoinedIterator;
|
|||
import org.hibernate.util.ReflectHelper;
|
||||
import org.hibernate.util.StringHelper;
|
||||
import org.hibernate.util.xml.XmlDocument;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Walks an XML mapping document and produces the Hibernate configuration-time metamodel (the
|
||||
|
@ -234,7 +228,7 @@ public final class HbmBinder {
|
|||
String rename = ( renameNode == null ) ?
|
||||
StringHelper.unqualify( className ) :
|
||||
renameNode.getValue();
|
||||
LOG.bindImport( rename, className );
|
||||
LOG.debug("Import: " + rename + " -> " + className);
|
||||
mappings.addImport( className, rename );
|
||||
}
|
||||
|
||||
|
@ -1324,7 +1318,7 @@ public final class HbmBinder {
|
|||
if ( columns.length() > 0 ) msg += " -> " + columns;
|
||||
// TODO: this fails if we run with debug on!
|
||||
// if ( model.getType()!=null ) msg += ", type: " + model.getType().getName();
|
||||
LOG.mappedProperty(msg);
|
||||
LOG.debug(msg);
|
||||
}
|
||||
|
||||
property.setMetaAttributes( getMetas( node, inheritedMetas ) );
|
||||
|
@ -2606,7 +2600,7 @@ public final class HbmBinder {
|
|||
if ( condition==null) {
|
||||
throw new MappingException("no filter condition found for filter: " + name);
|
||||
}
|
||||
LOG.applyingManyToManyFilter(name, condition, collection.getRole());
|
||||
LOG.debug("Applying many-to-many filter [" + name + "] as [" + condition + "] to role [" + collection.getRole() + "]");
|
||||
collection.addManyToManyFilter( name, condition );
|
||||
}
|
||||
}
|
||||
|
@ -2639,7 +2633,7 @@ public final class HbmBinder {
|
|||
String queryName = queryElem.attributeValue( "name" );
|
||||
if (path!=null) queryName = path + '.' + queryName;
|
||||
String query = queryElem.getText();
|
||||
LOG.namedQuery(queryName, query);
|
||||
LOG.debug("Named query: " + queryName + " -> " + query);
|
||||
|
||||
boolean cacheable = "true".equals( queryElem.attributeValue( "cacheable" ) );
|
||||
String region = queryElem.attributeValue( "cache-region" );
|
||||
|
@ -2972,7 +2966,7 @@ public final class HbmBinder {
|
|||
|
||||
private static void parseFilterDef(Element element, Mappings mappings) {
|
||||
String name = element.attributeValue( "name" );
|
||||
LOG.parsingFilterDefinition(name);
|
||||
LOG.debug("Parsing filter-def [" + name + "]");
|
||||
String defaultCondition = element.getTextTrim();
|
||||
if ( StringHelper.isEmpty( defaultCondition ) ) {
|
||||
defaultCondition = element.attributeValue( "condition" );
|
||||
|
@ -2983,12 +2977,12 @@ public final class HbmBinder {
|
|||
final Element param = (Element) params.next();
|
||||
final String paramName = param.attributeValue( "name" );
|
||||
final String paramType = param.attributeValue( "type" );
|
||||
LOG.addingFilterParameter(paramName, paramType);
|
||||
LOG.debug("Adding filter parameter : " + paramName + " -> " + paramType);
|
||||
final Type heuristicType = mappings.getTypeResolver().heuristicType( paramType );
|
||||
LOG.parameterHeuristicType(heuristicType);
|
||||
LOG.debug("Parameter heuristic type : " + heuristicType);
|
||||
paramMappings.put( paramName, heuristicType );
|
||||
}
|
||||
LOG.parsedFilterDefinition(name);
|
||||
LOG.debug("Parsed filter-def [" + name + "]");
|
||||
FilterDefinition def = new FilterDefinition( name, defaultCondition, paramMappings );
|
||||
mappings.addFilterDefinition( def );
|
||||
}
|
||||
|
@ -3011,7 +3005,7 @@ public final class HbmBinder {
|
|||
if ( condition==null) {
|
||||
throw new MappingException("no filter condition found for filter: " + name);
|
||||
}
|
||||
LOG.applyingFilter(name, condition);
|
||||
LOG.debug("Applying filter [" + name + "] as [" + condition + "]");
|
||||
filterable.addFilter( name, condition );
|
||||
}
|
||||
|
||||
|
@ -3147,87 +3141,4 @@ public final class HbmBinder {
|
|||
private static interface EntityElementHandler {
|
||||
public void handleEntity(String entityName, String className, Mappings mappings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Applying filter [%s] as [%s]" )
|
||||
void applyingFilter( String name,
|
||||
String condition );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Adding filter parameter : %s -> %s" )
|
||||
void addingFilterParameter( String paramName,
|
||||
String paramType );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Applying many-to-many filter [%s] as [%s] to role [%s]" )
|
||||
void applyingManyToManyFilter( String name,
|
||||
String condition,
|
||||
String role );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Attribute \"order-by\" ignored in JDK1.3 or less" )
|
||||
void attributeIgnored();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Import: %s -> %s" )
|
||||
void bindImport( String rename,
|
||||
String className );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "%s" )
|
||||
void mappedProperty( String message );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Mapping class: %s -> %s" )
|
||||
void mappingClass( String entityName,
|
||||
String name );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Mapping class join: %s -> %s" )
|
||||
void mappingClassJoin( String entityName,
|
||||
String name );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Mapping collection: %s -> %s" )
|
||||
void mappingCollection( String entityName,
|
||||
String name );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Mapping joined-subclass: %s -> %s" )
|
||||
void mappingJoinedSubclass( String entityName,
|
||||
String name );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Mapping subclass: %s -> %s" )
|
||||
void mappingSubclass( String entityName,
|
||||
String name );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Mapping union-subclass: %s -> %s" )
|
||||
void mappingUnionSubclass( String entityName,
|
||||
String name );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Named query: %s -> %s" )
|
||||
void namedQuery( String queryName,
|
||||
String query );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Parameter heuristic type : %s" )
|
||||
void parameterHeuristicType( Type heuristicType );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Parsed filter-def [%s]" )
|
||||
void parsedFilterDefinition( String name );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Parsing filter-def [%s]" )
|
||||
void parsingFilterDefinition( String name );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,20 +23,16 @@
|
|||
*/
|
||||
package org.hibernate.cfg;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import org.dom4j.Attribute;
|
||||
import org.dom4j.Element;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.engine.NamedSQLQueryDefinition;
|
||||
import org.hibernate.engine.ResultSetMappingDefinition;
|
||||
import org.hibernate.util.StringHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
|
@ -120,19 +116,7 @@ public class NamedSQLQuerySecondPass extends ResultSetMappingBinder implements Q
|
|||
);
|
||||
}
|
||||
|
||||
LOG.namedSqlQuery(queryName, namedQuery.getQueryString());
|
||||
LOG.debug("Named SQL query: " + queryName + " -> " + namedQuery.getQueryString());
|
||||
mappings.addSQLQuery( queryName, namedQuery );
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Named SQL query: %s -> %s" )
|
||||
void namedSqlQuery( String queryName,
|
||||
String namedQuery );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
package org.hibernate.cfg;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -39,6 +38,7 @@ import javax.persistence.OneToMany;
|
|||
import javax.persistence.OneToOne;
|
||||
import javax.persistence.Transient;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.ManyToAny;
|
||||
import org.hibernate.annotations.Target;
|
||||
|
@ -46,10 +46,6 @@ import org.hibernate.annotations.Type;
|
|||
import org.hibernate.annotations.common.reflection.XClass;
|
||||
import org.hibernate.annotations.common.reflection.XProperty;
|
||||
import org.hibernate.util.StringHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* A helper class to keep the {@code XProperty}s of a class ordered by access type.
|
||||
|
@ -278,17 +274,6 @@ class PropertyContainer {
|
|||
|| "net.sf.cglib.transform.impl.InterceptFieldCallback".equals( property.getType().getName() )
|
||||
|| "org.hibernate.bytecode.javassist.FieldHandler".equals( property.getType().getName() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Placing @Access(AccessType.%s) on a field does not have any effect." )
|
||||
void annotationHasNoEffect( AccessType type );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -23,11 +23,7 @@
|
|||
*/
|
||||
package org.hibernate.cfg;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
|
@ -51,10 +47,6 @@ import org.hibernate.transaction.TransactionManagerLookup;
|
|||
import org.hibernate.transaction.TransactionManagerLookupFactory;
|
||||
import org.hibernate.util.ReflectHelper;
|
||||
import org.hibernate.util.StringHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Reads configuration properties and builds a {@link Settings} instance.
|
||||
|
@ -285,7 +277,7 @@ public class SettingsFactory implements Serializable {
|
|||
return new org.hibernate.bytecode.cglib.BytecodeProviderImpl();
|
||||
}
|
||||
else {
|
||||
LOG.usingJavassist();
|
||||
LOG.debug("Using javassist as bytecode provider by default");
|
||||
return new org.hibernate.bytecode.javassist.BytecodeProviderImpl();
|
||||
}
|
||||
}
|
||||
|
@ -378,193 +370,4 @@ public class SettingsFactory implements Serializable {
|
|||
protected TransactionManagerLookup createTransactionManagerLookup(Properties properties) {
|
||||
return TransactionManagerLookupFactory.getTransactionManagerLookup(properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Automatic flush during beforeCompletion(): %s" )
|
||||
void autoFlush( String enabledDisabled );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Automatic session close at end of transaction: %s" )
|
||||
void autoSessionClose( String enabledDisabled );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Batcher factory: %s" )
|
||||
void batcherFactory( String batcherClass );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Cache region factory : %s" )
|
||||
void cacheRegionFactory( String regionFactoryClassName );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Cache region prefix: %s" )
|
||||
void cacheRegionPrefix( String prefix );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Check Nullability in Core (should be disabled when Bean Validation is on): %s" )
|
||||
void checkNullability( String enabledDisabled );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Connection release mode: %s" )
|
||||
void connectionReleaseMode( String releaseModeName );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "%s did not provide constructor accepting java.util.Properties; attempting no-arg constructor." )
|
||||
void constructorWithPropertiesNotFound( String regionFactoryClassName );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
// @formatter:off
|
||||
@Message( value = "Database ->\n" +
|
||||
" name : %s\n" +
|
||||
" version : %s\n" +
|
||||
" major : %s\n" +
|
||||
" minor : %s" )
|
||||
// @formatter:on
|
||||
void database( String databaseProductName,
|
||||
String databaseProductVersion,
|
||||
int databaseMajorVersion,
|
||||
int databaseMinorVersion );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Default batch fetch size: %s" )
|
||||
void defaultBatchFetchSize( int batchFetchSize );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Default catalog: %s" )
|
||||
void defaultCatalog( String defaultCatalog );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Default entity-mode: %s" )
|
||||
void defaultEntityMode( EntityMode defaultEntityMode );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Default schema: %s" )
|
||||
void defaultSchema( String defaultSchema );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Deleted entity synthetic identifier rollback: %s" )
|
||||
void deletedEntitySyntheticIdentifierRollback( String enabledDisabled );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
// @formatter:off
|
||||
@Message( value = "Driver ->\n" +
|
||||
" name : %s\n" +
|
||||
" version : %s\n" +
|
||||
" major : %s\n" +
|
||||
" minor : %s" )
|
||||
// @formatter:on
|
||||
void driver( String driverProductName,
|
||||
String driverProductVersion,
|
||||
int driverMajorVersion,
|
||||
int driverMinorVersion );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Echoing all SQL to stdout" )
|
||||
void echoingSql();
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Generate SQL with comments: %s" )
|
||||
void generateSqlWithComments( String enabledDisabled );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "JDBC3 getGeneratedKeys(): %s" )
|
||||
void jdbc3GeneratedKeys( String enabledDisabled );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "JDBC batch size: %s" )
|
||||
void jdbcBatchSize( int batchSize );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "JDBC batch updates for versioned data: %s" )
|
||||
void jdbcBatchUpdates( String enabledDisabled );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "JDBC result set fetch size: %s" )
|
||||
void jdbcResultSetFetchSize( Integer statementFetchSize );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "JPA-QL strict compliance: %s" )
|
||||
void jpaQlStrictCompliance( String enabledDisabled );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Maximum outer join fetch depth: %s" )
|
||||
void maxOuterJoinFetchDepth( Integer maxFetchDepth );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Named query checking : %s" )
|
||||
void namedQueryChecking( String enabledDisabled );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Optimize cache for minimal puts: %s" )
|
||||
void optimizeCacheForMinimalInputs( String enabledDisabled );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Order SQL inserts for batching: %s" )
|
||||
void orderSqlInsertsForBatching( String enabledDisabled );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Order SQL updates by primary key: %s" )
|
||||
void orderSqlUpdatesByPrimaryKey( String enabledDisabled );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Query cache: %s" )
|
||||
void queryCache( String enabledDisabled );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Query cache factory: %s" )
|
||||
void queryCacheFactory( String queryCacheFactoryClassName );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Query language substitutions: %s" )
|
||||
void queryLanguageSubstitutions( Map<String, String> querySubstitutions );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Query translator: %s" )
|
||||
void queryTranslator( String className );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Scrollable result sets: %s" )
|
||||
void scrollabelResultSets( String enabledDisabled );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Second-level cache: %s" )
|
||||
void secondLevelCache( String enabledDisabled );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Statistics: %s" )
|
||||
void statistics( String enabledDisabled );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Structured second-level cache entries: %s" )
|
||||
void structuredSecondLevelCacheEntries( String enabledDisabled );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Could not obtain connection metadata: %s" )
|
||||
void unableToObjectConnectionMetadata( SQLException error );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Could not obtain connection to query metadata: %s" )
|
||||
void unableToObjectConnectionToQueryMetadata( SQLException error );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Overriding release mode as connection provider does not support 'after_statement'" )
|
||||
void unsupportedAfterStatement();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Using javassist as bytecode provider by default" )
|
||||
void usingJavassist();
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Error building SQLExceptionConverter; using minimal converter" )
|
||||
void usingMinimalConverter();
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Wrap result sets: %s" )
|
||||
void wrapResultSets( String enabledDisabled );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.cfg.annotations;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
|
@ -46,6 +44,7 @@ import javax.persistence.MapKeyColumn;
|
|||
import javax.persistence.OneToMany;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.BatchSize;
|
||||
import org.hibernate.annotations.Cache;
|
||||
|
@ -110,10 +109,6 @@ import org.hibernate.mapping.SimpleValue;
|
|||
import org.hibernate.mapping.SingleTableSubclass;
|
||||
import org.hibernate.mapping.Table;
|
||||
import org.hibernate.util.StringHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Base class for binding different types of collections to Hibernate configuration objects.
|
||||
|
@ -376,7 +371,7 @@ public abstract class CollectionBinder {
|
|||
public void bind() {
|
||||
this.collection = createCollection( propertyHolder.getPersistentClass() );
|
||||
String role = StringHelper.qualify(propertyHolder.getPath(), propertyName);
|
||||
LOG.collectionRole(role);
|
||||
LOG.debug("Collection role: " + role);
|
||||
collection.setRole(role);
|
||||
collection.setNodeName( propertyName );
|
||||
|
||||
|
@ -720,7 +715,7 @@ public abstract class CollectionBinder {
|
|||
String hqlOrderBy,
|
||||
Mappings mappings,
|
||||
Map<XClass, InheritanceState> inheritanceStatePerClass) {
|
||||
LOG.bindingOneToMany(propertyHolder.getEntityName(), propertyName);
|
||||
LOG.debug("Binding a OneToMany: " + propertyHolder.getEntityName() + "." + propertyName + " through a foreign key");
|
||||
org.hibernate.mapping.OneToMany oneToMany = new org.hibernate.mapping.OneToMany( mappings, collection.getOwner() );
|
||||
collection.setElement( oneToMany );
|
||||
oneToMany.setReferencedEntityName( collectionType.getName() );
|
||||
|
@ -1151,10 +1146,10 @@ public abstract class CollectionBinder {
|
|||
ManyToAny anyAnn = property.getAnnotation( ManyToAny.class );
|
||||
if (LOG.isDebugEnabled()) {
|
||||
String path = collValue.getOwnerEntityName() + "." + joinColumns[0].getPropertyName();
|
||||
if (isCollectionOfEntities && unique) LOG.bindingOneToMany(path);
|
||||
else if (isCollectionOfEntities) LOG.bindingManyToMany(path);
|
||||
else if (anyAnn != null) LOG.bindingManyToAny(path);
|
||||
else LOG.bindingCollection(path);
|
||||
if (isCollectionOfEntities && unique) LOG.debug("Binding a OneToMany: " + path + " through an association table");
|
||||
else if (isCollectionOfEntities) LOG.debug("Binding as ManyToMany: " + path);
|
||||
else if (anyAnn != null) LOG.debug("Binding a ManyToAny: " + path);
|
||||
else LOG.debug("Binding a collection of element: " + path);
|
||||
}
|
||||
//check for user error
|
||||
if ( !isCollectionOfEntities ) {
|
||||
|
@ -1541,41 +1536,4 @@ public abstract class CollectionBinder {
|
|||
public void setLocalGenerators(HashMap<String, IdGenerator> localGenerators) {
|
||||
this.localGenerators = localGenerators;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Binding a collection of element: %s" )
|
||||
void bindingCollection( String property );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Binding a ManyToAny: %s" )
|
||||
void bindingManyToAny( String property );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Binding as ManyToMany: %s" )
|
||||
void bindingManyToMany( String property );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Binding a OneToMany: %s through an association table" )
|
||||
void bindingOneToMany( String property );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Binding a OneToMany: %s.%s through a foreign key" )
|
||||
void bindingOneToMany( String entity,
|
||||
String property );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Collection role: %s" )
|
||||
void collectionRole( String role );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Mapping collection: %s -> %s" )
|
||||
void mappingCollection( String role,
|
||||
String collectionTable );
|
||||
}
|
||||
}
|
|
@ -23,9 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.cfg.annotations;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
@ -40,6 +37,7 @@ import javax.persistence.SecondaryTables;
|
|||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.BatchSize;
|
||||
import org.hibernate.annotations.Cache;
|
||||
|
@ -87,10 +85,6 @@ import org.hibernate.mapping.TableOwner;
|
|||
import org.hibernate.mapping.Value;
|
||||
import org.hibernate.util.ReflectHelper;
|
||||
import org.hibernate.util.StringHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Stateful holder and processor for binding Entity information
|
||||
|
@ -345,7 +339,7 @@ public class EntityBinder {
|
|||
persistentClass.addFilter( filterName, cond );
|
||||
}
|
||||
} else if (filters.size() > 0) LOG.filterAnnotationOnSubclass(persistentClass.getEntityName());
|
||||
LOG.importWithEntityName(name);
|
||||
LOG.debug("Import with entity name " + name);
|
||||
try {
|
||||
mappings.addImport( persistentClass.getEntityName(), name );
|
||||
String entityName = persistentClass.getEntityName();
|
||||
|
@ -922,37 +916,4 @@ public class EntityBinder {
|
|||
|
||||
return accessType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Adding secondary table to entity %s -> %s" )
|
||||
void addingSecondaryTableToEntity( String entity,
|
||||
String table );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Bind entity %s on table %s" )
|
||||
void bindEntityOnTable( String entity,
|
||||
String table );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "@org.hibernate.annotations.Entity used on a non root entity: ignored for %s" )
|
||||
void entityAnnotationOnNonRoot( String className );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "@Filter not allowed on subclasses (ignored): %s" )
|
||||
void filterAnnotationOnSubclass( String className );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "@Immutable used on a non root entity: ignored for %s" )
|
||||
void immutableAnnotationOnNonRoot( String className );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Import with entity name %s" )
|
||||
void importWithEntityName( String entity );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
*/
|
||||
package org.hibernate.cfg.annotations;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.util.Map;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.OrderBy;
|
||||
import org.hibernate.annotations.Sort;
|
||||
|
@ -45,10 +45,6 @@ import org.hibernate.mapping.OneToMany;
|
|||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.mapping.SimpleValue;
|
||||
import org.hibernate.util.StringHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Bind a list to the underlying Hibernate configuration
|
||||
|
@ -147,19 +143,4 @@ public class ListBinder extends CollectionBinder {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "@OrderBy not allowed for an indexed collection, annotation ignored." )
|
||||
void orderByAnnotationIndexedCollection();
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "@Sort not allowed for an indexed collection, annotation ignored." )
|
||||
void sortAnnotationIndexedCollection();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,12 +23,11 @@
|
|||
*/
|
||||
package org.hibernate.cfg.annotations;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import java.util.Map;
|
||||
import javax.persistence.EmbeddedId;
|
||||
import javax.persistence.Id;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.annotations.Generated;
|
||||
import org.hibernate.annotations.GenerationTime;
|
||||
import org.hibernate.annotations.Immutable;
|
||||
|
@ -53,10 +52,6 @@ import org.hibernate.mapping.RootClass;
|
|||
import org.hibernate.mapping.SimpleValue;
|
||||
import org.hibernate.mapping.Value;
|
||||
import org.hibernate.util.StringHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
|
@ -176,7 +171,7 @@ public class PropertyBinder {
|
|||
|
||||
private Property makePropertyAndValue() {
|
||||
validateBind();
|
||||
LOG.bindingPropertyWithLazy(name, lazy);
|
||||
LOG.debug("Binder property " + name + " with lazy=" + lazy);
|
||||
String containerClassName = holder == null ?
|
||||
null :
|
||||
holder.getClassName();
|
||||
|
@ -256,7 +251,7 @@ public class PropertyBinder {
|
|||
//used when the value is provided and the binding is done elsewhere
|
||||
public Property makeProperty() {
|
||||
validateMake();
|
||||
LOG.buildingProperty(name);
|
||||
LOG.debug("Building property " + name);
|
||||
Property prop = new Property();
|
||||
prop.setName( name );
|
||||
prop.setNodeName( name );
|
||||
|
@ -313,7 +308,7 @@ public class PropertyBinder {
|
|||
);
|
||||
}
|
||||
}
|
||||
LOG.cascadingProperty(name, cascade);
|
||||
LOG.trace("Cascading " + name + " with " + cascade);
|
||||
this.mappingProperty = prop;
|
||||
return prop;
|
||||
}
|
||||
|
@ -341,25 +336,4 @@ public class PropertyBinder {
|
|||
public void setInheritanceStatePerClass(Map<XClass, InheritanceState> inheritanceStatePerClass) {
|
||||
this.inheritanceStatePerClass = inheritanceStatePerClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Binder property %s with lazy=%s" )
|
||||
void bindingPropertyWithLazy( String property,
|
||||
boolean lazy );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Building property %s" )
|
||||
void buildingProperty( String property );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Cascading %s with %s" )
|
||||
void cascadingProperty( String property,
|
||||
String cascade );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.cfg.annotations;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import java.util.HashMap;
|
||||
import javax.persistence.NamedNativeQueries;
|
||||
import javax.persistence.NamedNativeQuery;
|
||||
|
@ -37,6 +36,7 @@ import org.hibernate.AssertionFailure;
|
|||
import org.hibernate.CacheMode;
|
||||
import org.hibernate.FlushMode;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.annotations.CacheModeType;
|
||||
import org.hibernate.annotations.FlushModeType;
|
||||
import org.hibernate.cfg.BinderHelper;
|
||||
|
@ -46,10 +46,6 @@ import org.hibernate.engine.NamedQueryDefinition;
|
|||
import org.hibernate.engine.NamedSQLQueryDefinition;
|
||||
import org.hibernate.engine.query.sql.NativeSQLQueryReturn;
|
||||
import org.hibernate.engine.query.sql.NativeSQLQueryRootReturn;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Query binder
|
||||
|
@ -424,21 +420,4 @@ public abstract class QueryBinder {
|
|||
}
|
||||
return timeout;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Binding named native query: %s => %s" )
|
||||
void bindingNamedNativeQuery( String name,
|
||||
String query );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Binding named query: %s => %s" )
|
||||
void bindingNamedQuery( String name,
|
||||
String query );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.cfg.annotations;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
@ -36,6 +35,7 @@ import javax.persistence.EntityResult;
|
|||
import javax.persistence.FieldResult;
|
||||
import javax.persistence.SqlResultSetMapping;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.cfg.BinderHelper;
|
||||
import org.hibernate.cfg.Mappings;
|
||||
|
@ -49,10 +49,6 @@ import org.hibernate.mapping.Property;
|
|||
import org.hibernate.mapping.ToOne;
|
||||
import org.hibernate.mapping.Value;
|
||||
import org.hibernate.util.StringHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
|
@ -269,15 +265,4 @@ public class ResultsetMappingSecondPass implements QuerySecondPass {
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Binding result set mapping: %s" )
|
||||
void bindingResultSetMapping( String mapping );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,15 +23,11 @@
|
|||
*/
|
||||
package org.hibernate.cfg.annotations;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.annotations.OrderBy;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.mapping.Collection;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Bind a set.
|
||||
|
@ -62,15 +58,4 @@ public class SetBinder extends CollectionBinder {
|
|||
else LOG.orderByAttributeIgnored();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Attribute \"order-by\" ignored in JDK1.3 or less" )
|
||||
void orderByAttributeIgnored();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.cfg.annotations;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Types;
|
||||
import java.util.Calendar;
|
||||
|
@ -38,6 +37,7 @@ import javax.persistence.TemporalType;
|
|||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.annotations.Parameter;
|
||||
import org.hibernate.annotations.Type;
|
||||
import org.hibernate.annotations.common.reflection.XClass;
|
||||
|
@ -57,10 +57,6 @@ import org.hibernate.type.PrimitiveCharacterArrayClobType;
|
|||
import org.hibernate.type.SerializableToBlobType;
|
||||
import org.hibernate.type.WrappedMaterializedBlobType;
|
||||
import org.hibernate.util.StringHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
|
@ -303,7 +299,7 @@ public class SimpleValueBinder {
|
|||
public SimpleValue make() {
|
||||
|
||||
validate();
|
||||
LOG.buildingSimpleValue(propertyName);
|
||||
LOG.debug("building SimpleValue for " + propertyName);
|
||||
if ( table == null ) {
|
||||
table = columns[0].getTable();
|
||||
}
|
||||
|
@ -341,7 +337,7 @@ public class SimpleValueBinder {
|
|||
|
||||
public void fillSimpleValue() {
|
||||
|
||||
LOG.settingSimpleValueTypeName(propertyName);
|
||||
LOG.debug("Setting SimpleValue typeName for " + propertyName);
|
||||
|
||||
String type = BinderHelper.isEmptyAnnotationValue( explicitType ) ? returnedClassName : explicitType;
|
||||
org.hibernate.mapping.TypeDef typeDef = mappings.getTypeDef( type );
|
||||
|
@ -371,19 +367,4 @@ public class SimpleValueBinder {
|
|||
public void setKey(boolean key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "building SimpleValue for %s" )
|
||||
void buildingSimpleValue( String propertyName );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Setting SimpleValue typeName for %s" )
|
||||
void settingSimpleValueTypeName( String propertyName );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,13 +23,13 @@
|
|||
*/
|
||||
package org.hibernate.cfg.annotations;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import javax.persistence.UniqueConstraint;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.annotations.Index;
|
||||
import org.hibernate.cfg.BinderHelper;
|
||||
import org.hibernate.cfg.Ejb3JoinColumn;
|
||||
|
@ -51,10 +51,6 @@ import org.hibernate.mapping.ToOne;
|
|||
import org.hibernate.mapping.Value;
|
||||
import org.hibernate.util.CollectionHelper;
|
||||
import org.hibernate.util.StringHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Table related operations
|
||||
|
@ -343,7 +339,7 @@ public class TableBinder {
|
|||
* Get the columns of the mapped-by property
|
||||
* copy them and link the copy to the actual value
|
||||
*/
|
||||
LOG.retreivingProperty(associatedClass.getEntityName(), mappedByProperty);
|
||||
LOG.debug("Retrieving property " + associatedClass.getEntityName() + "." + mappedByProperty);
|
||||
|
||||
final Property property = associatedClass.getRecursiveProperty( columns[0].getMappedBy() );
|
||||
Iterator mappedByColumns;
|
||||
|
@ -450,7 +446,7 @@ public class TableBinder {
|
|||
Iterator idColItr = referencedEntity.getKey().getColumnIterator();
|
||||
org.hibernate.mapping.Column col;
|
||||
Table table = referencedEntity.getTable(); //works cause the pk has to be on the primary table
|
||||
if (!idColItr.hasNext()) LOG.noColumnInIdentifier();
|
||||
if (!idColItr.hasNext()) LOG.debug("No column in the identifier!");
|
||||
while ( idColItr.hasNext() ) {
|
||||
boolean match = false;
|
||||
//for each PK column, find the associated FK column.
|
||||
|
@ -578,20 +574,4 @@ public class TableBinder {
|
|||
this.propertyName = propertyName;
|
||||
this.name = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Retrieving property %s.%s" )
|
||||
void retreivingProperty( String entityName,
|
||||
String propertyName );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "No column in the identifier!" )
|
||||
void noColumnInIdentifier();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
|
||||
package org.hibernate.cfg.annotations.reflection;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.beans.Introspector;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.AccessibleObject;
|
||||
|
@ -119,6 +118,7 @@ import javax.persistence.Version;
|
|||
import org.dom4j.Attribute;
|
||||
import org.dom4j.Element;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.annotations.Cascade;
|
||||
import org.hibernate.annotations.CollectionOfElements;
|
||||
import org.hibernate.annotations.Columns;
|
||||
|
@ -129,10 +129,6 @@ import org.hibernate.annotations.common.reflection.Filter;
|
|||
import org.hibernate.annotations.common.reflection.ReflectionUtil;
|
||||
import org.hibernate.util.ReflectHelper;
|
||||
import org.hibernate.util.StringHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Encapsulates the overriding of Java annotations from an EJB 3.0 descriptor.
|
||||
|
@ -2504,15 +2500,4 @@ public class JPAOverridenAnnotationReader implements AnnotationReader {
|
|||
private Annotation[] getJavaAnnotations() {
|
||||
return element.getAnnotations();
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Property %s not found in class but described in <mapping-file/> (possible typo error)" )
|
||||
void propertyNotFound( String property );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,9 +26,6 @@
|
|||
|
||||
package org.hibernate.cfg.annotations.reflection;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -38,11 +35,8 @@ import javax.persistence.AccessType;
|
|||
import org.dom4j.Document;
|
||||
import org.dom4j.Element;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.util.StringHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
|
@ -159,7 +153,7 @@ public class XMLContext implements Serializable {
|
|||
setAccess( access, localDefault );
|
||||
defaultsOverriding.put( className, localDefault );
|
||||
|
||||
LOG.addingOverridingInformation(className);
|
||||
LOG.debug("Adding XML overriding information for " + className);
|
||||
addEntityListenerClasses( element, packageName, addedClasses );
|
||||
}
|
||||
}
|
||||
|
@ -186,7 +180,7 @@ public class XMLContext implements Serializable {
|
|||
classOverriding.put( listenerClassName, listener );
|
||||
}
|
||||
}
|
||||
LOG.addingListenerOverridingInformation(localAddedClasses);
|
||||
LOG.debug("Adding XML overriding information for listeners: " + localAddedClasses);
|
||||
addedClasses.addAll( localAddedClasses );
|
||||
return localAddedClasses;
|
||||
}
|
||||
|
@ -312,27 +306,4 @@ public class XMLContext implements Serializable {
|
|||
public List<String> getDefaultEntityListeners() {
|
||||
return defaultEntityListeners;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Adding XML overriding information for %s" )
|
||||
void addingOverridingInformation( String className );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Adding XML overriding information for listeners: %s" )
|
||||
void addingListenerOverridingInformation( List<String> classNames );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "entity-listener duplication, first event definition will be used: %s" )
|
||||
void duplicateListener( String className );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Found more than one <persistence-unit-metadata>, subsequent ignored" )
|
||||
void duplicateMetadata();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.cfg.beanvalidation;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import java.util.HashSet;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
@ -35,6 +34,7 @@ import javax.validation.Validation;
|
|||
import javax.validation.Validator;
|
||||
import javax.validation.ValidatorFactory;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.event.Initializable;
|
||||
|
@ -45,10 +45,6 @@ import org.hibernate.event.PreInsertEventListener;
|
|||
import org.hibernate.event.PreUpdateEvent;
|
||||
import org.hibernate.event.PreUpdateEventListener;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Event listener used to enable Bean Validation for insert/update/delete events.
|
||||
|
@ -142,7 +138,7 @@ public class BeanValidationEventListener implements
|
|||
new HashSet<ConstraintViolation<?>>( constraintViolations.size() );
|
||||
Set<String> classNames = new HashSet<String>();
|
||||
for ( ConstraintViolation<?> violation : constraintViolations ) {
|
||||
LOG.violation(violation);
|
||||
LOG.trace(violation);
|
||||
propagatedViolations.add( violation );
|
||||
classNames.add( violation.getLeafBean().getClass().getName() );
|
||||
}
|
||||
|
@ -174,15 +170,4 @@ public class BeanValidationEventListener implements
|
|||
toString.append( "]" );
|
||||
return toString.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "%s" )
|
||||
void violation( ConstraintViolation<?> violation );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.cfg.beanvalidation;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
@ -57,10 +56,6 @@ import org.hibernate.mapping.Property;
|
|||
import org.hibernate.mapping.SingleTableSubclass;
|
||||
import org.hibernate.util.ReflectHelper;
|
||||
import org.hibernate.util.StringHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* @author Emmanuel Bernard
|
||||
|
@ -387,16 +382,4 @@ class TypeSafeActivator {
|
|||
}
|
||||
return factory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Unable to apply constraints on DDL for %s\n%s" )
|
||||
void unableToApplyConstraints( String className,
|
||||
String message );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,10 +23,9 @@
|
|||
*/
|
||||
package org.hibernate.cfg.search;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import java.util.Properties;
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.event.EventListeners;
|
||||
import org.hibernate.event.PostCollectionRecreateEventListener;
|
||||
import org.hibernate.event.PostCollectionRemoveEventListener;
|
||||
|
@ -35,10 +34,6 @@ import org.hibernate.event.PostDeleteEventListener;
|
|||
import org.hibernate.event.PostInsertEventListener;
|
||||
import org.hibernate.event.PostUpdateEventListener;
|
||||
import org.hibernate.util.ReflectHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Helper methods initializing Hibernate Search event listeners.
|
||||
|
@ -231,7 +226,7 @@ public class HibernateSearchEventListenerRegister {
|
|||
FULL_TEXT_INDEX_EVENT_LISTENER_CLASS,
|
||||
HibernateSearchEventListenerRegister.class);
|
||||
} catch (ClassNotFoundException e) {
|
||||
LOG.unableToFindListenerClass();
|
||||
LOG.debug("Search not present in classpath, ignoring event listener registration.");
|
||||
}
|
||||
return searchEventListenerClass;
|
||||
}
|
||||
|
@ -246,23 +241,4 @@ public class HibernateSearchEventListenerRegister {
|
|||
}
|
||||
return searchEventListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Property hibernate.search.autoregister_listeners is set to false. No attempt will be made to register Hibernate Search event listeners." )
|
||||
void willNotRegisterListeners();
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Unable to find %s on the classpath. Hibernate Search is not enabled." )
|
||||
void unableToFindListenerClass( String className );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Search not present in classpath, ignoring event listener registration." )
|
||||
void unableToFindListenerClass();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
*/
|
||||
package org.hibernate.collection;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.ERROR;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Array;
|
||||
import java.sql.ResultSet;
|
||||
|
@ -34,14 +33,11 @@ import java.util.Collection;
|
|||
import java.util.Iterator;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.loader.CollectionAliases;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.type.Type;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* A persistent wrapper for an array. Lazy initialization
|
||||
|
@ -257,15 +253,4 @@ public class PersistentArrayHolder extends AbstractPersistentCollection {
|
|||
public boolean entryExists(Object entry, int i) {
|
||||
return entry!=null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = ERROR )
|
||||
@Message( value = "Array element type error\n%s" )
|
||||
void invalidArrayElementType( String message );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
*/
|
||||
package org.hibernate.context;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
import javax.transaction.Synchronization;
|
||||
|
@ -32,13 +31,10 @@ import javax.transaction.Transaction;
|
|||
import javax.transaction.TransactionManager;
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.classic.Session;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.util.JTAHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* An implementation of {@link CurrentSessionContext} which scopes the notion
|
||||
|
@ -121,7 +117,7 @@ public class JTASessionContext implements CurrentSessionContext {
|
|||
currentSession.close();
|
||||
}
|
||||
catch ( Throwable ignore ) {
|
||||
LOG.unableToReleaseSession(ignore.getMessage());
|
||||
LOG.debug("Unable to release generated current-session on failed synch registration", ignore);
|
||||
}
|
||||
throw new HibernateException( "Unable to register cleanup Synchronization with TransactionManager" );
|
||||
}
|
||||
|
@ -212,15 +208,4 @@ public class JTASessionContext implements CurrentSessionContext {
|
|||
context.currentSessionMap.remove( transactionIdentifier );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Unable to release generated current-session on failed synch registration\n%s" )
|
||||
void unableToReleaseSession( String message );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,6 @@
|
|||
*/
|
||||
package org.hibernate.context;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
@ -40,13 +37,10 @@ import java.util.Map;
|
|||
import javax.transaction.Synchronization;
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.classic.Session;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* A {@link CurrentSessionContext} impl which scopes the notion of current
|
||||
|
@ -216,13 +210,13 @@ public class ThreadLocalSessionContext implements CurrentSessionContext {
|
|||
orphan.getTransaction().rollback();
|
||||
}
|
||||
catch( Throwable t ) {
|
||||
LOG.unableToRollbackTransaction(t.getMessage());
|
||||
LOG.debug("Unable to rollback transaction for orphaned session", t);
|
||||
}
|
||||
}
|
||||
orphan.close();
|
||||
}
|
||||
catch( Throwable t ) {
|
||||
LOG.unableToCloseOrphanedSession(t.getMessage());
|
||||
LOG.debug("Unable to close orphaned session", t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -238,12 +232,8 @@ public class ThreadLocalSessionContext implements CurrentSessionContext {
|
|||
|
||||
private static Session existingSession(SessionFactory factory) {
|
||||
Map sessionMap = sessionMap();
|
||||
if ( sessionMap == null ) {
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
return ( Session ) sessionMap.get( factory );
|
||||
}
|
||||
if (sessionMap == null) return null;
|
||||
return (Session)sessionMap.get(factory);
|
||||
}
|
||||
|
||||
protected static Map sessionMap() {
|
||||
|
@ -335,7 +325,7 @@ public class ThreadLocalSessionContext implements CurrentSessionContext {
|
|||
|| "isTransactionInProgress".equals( method.getName() )
|
||||
|| "setFlushMode".equals( method.getName() )
|
||||
|| "getSessionFactory".equals( method.getName() ) ) {
|
||||
LOG.allowingMethodInNonTransactedContext(method.getName());
|
||||
LOG.trace("Allowing method [" + method.getName() + "] in non-transacted context");
|
||||
}
|
||||
else if ( "reconnect".equals( method.getName() )
|
||||
|| "disconnect".equals( method.getName() ) ) {
|
||||
|
@ -345,16 +335,12 @@ public class ThreadLocalSessionContext implements CurrentSessionContext {
|
|||
throw new HibernateException( method.getName() + " is not valid without active transaction" );
|
||||
}
|
||||
}
|
||||
LOG.allowingProxiedMethodInSession(method.getName());
|
||||
LOG.trace("Allowing proxied method [" + method.getName() + "] to proceed to real session");
|
||||
return method.invoke( realSession, args );
|
||||
}
|
||||
catch ( InvocationTargetException e ) {
|
||||
if ( e.getTargetException() instanceof RuntimeException ) {
|
||||
throw ( RuntimeException ) e.getTargetException();
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
}
|
||||
if (e.getTargetException() instanceof RuntimeException) throw (RuntimeException)e.getTargetException();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -389,31 +375,4 @@ public class ThreadLocalSessionContext implements CurrentSessionContext {
|
|||
doBind( wrappedSession, factory );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Allowing method [%s] in non-transacted context" )
|
||||
void allowingMethodInNonTransactedContext( String name );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Allowing proxied method [%s] to proceed to real session" )
|
||||
void allowingProxiedMethodInSession( String name );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Already session bound on call to bind(); make sure you clean up your sessions!" )
|
||||
void alreadySessionBound();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Unable to close orphaned session\n%s" )
|
||||
void unableToCloseOrphanedSession( String message );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Unable to rollback transaction for orphaned session\n%s" )
|
||||
void unableToRollbackTransaction( String message );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,18 +23,14 @@
|
|||
*/
|
||||
package org.hibernate.dialect;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.lang.reflect.Method;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.dialect.function.AnsiTrimFunction;
|
||||
import org.hibernate.dialect.function.DerbyConcatFunction;
|
||||
import org.hibernate.sql.CaseFragment;
|
||||
import org.hibernate.sql.DerbyCaseFragment;
|
||||
import org.hibernate.util.ReflectHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Hibernate Dialect for Cloudscape 10 - aka Derby. This implements both an
|
||||
|
@ -238,15 +234,4 @@ public String getForUpdateString() {
|
|||
public boolean supportsLobValueChangePropogation() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Unable to load/access derby driver class sysinfo to check versions : %s" )
|
||||
void unableToLoadDerbyDriver( String message );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.dialect;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
@ -36,6 +35,7 @@ import java.util.Set;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.function.CastFunction;
|
||||
|
@ -66,10 +66,6 @@ import org.hibernate.sql.JoinFragment;
|
|||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.util.ReflectHelper;
|
||||
import org.hibernate.util.StringHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Represents a dialect of SQL implemented by a particular RDBMS.
|
||||
|
@ -1930,22 +1926,11 @@ public abstract class Dialect {
|
|||
|
||||
/**
|
||||
* Does this dialect support `count(distinct a,b)`?
|
||||
*
|
||||
*
|
||||
* @return True if the database supports counting distinct tuples; false otherwise.
|
||||
*/
|
||||
public boolean supportsTupleDistinctCounts() {
|
||||
// oddly most database in fact seem to, so true is the default.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Using dialect: %s" )
|
||||
void usingDialect( Dialect dialect );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
*/
|
||||
package org.hibernate.dialect;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.function.AvgWithArgumentCastFunction;
|
||||
import org.hibernate.dialect.function.NoArgSQLFunction;
|
||||
|
@ -35,10 +35,6 @@ import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
|
|||
import org.hibernate.exception.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.util.ReflectHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* A dialect compatible with the H2 database.
|
||||
|
@ -345,17 +341,4 @@ public class H2Dialect extends Dialect {
|
|||
// see http://groups.google.com/group/h2-database/browse_thread/thread/562d8a49e2dabe99?hl=en
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "The %d.%d.%d version of H2 implements temporary table creation such that it commits current transaction; multi-table, bulk hql/jpaql will not work properly" )
|
||||
void unsupportedMultiTableBulkHqlJpaql( int majorVersion,
|
||||
int minorVersion,
|
||||
int buildId );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,12 +23,12 @@
|
|||
*/
|
||||
package org.hibernate.dialect;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.StaleObjectStateException;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.function.AvgWithArgumentCastFunction;
|
||||
|
@ -50,10 +50,6 @@ import org.hibernate.exception.ViolatedConstraintNameExtracter;
|
|||
import org.hibernate.persister.entity.Lockable;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.util.ReflectHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* An SQL dialect compatible with HSQLDB (HyperSQL).
|
||||
|
@ -666,15 +662,4 @@ public class HSQLDialect extends Dialect {
|
|||
public boolean supportsTupleDistinctCounts() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "HSQLDB supports only READ_UNCOMMITTED isolation" )
|
||||
void hsqldbSupportsOnlyReadCommittedIsolation();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,12 +23,12 @@
|
|||
*/
|
||||
package org.hibernate.dialect;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Types;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.function.NoArgSQLFunction;
|
||||
import org.hibernate.dialect.function.NvlFunction;
|
||||
|
@ -40,10 +40,6 @@ import org.hibernate.exception.TemplatedViolatedConstraintNameExtracter;
|
|||
import org.hibernate.exception.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.util.ReflectHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* An SQL dialect for Oracle 9 (uses ANSI-style syntax where possible).
|
||||
|
@ -372,15 +368,4 @@ public class Oracle9Dialect extends Dialect {
|
|||
public boolean supportsExistsInSelect() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "The Oracle9Dialect dialect has been deprecated; use either Oracle9iDialect or Oracle10gDialect instead" )
|
||||
void deprecatedOracle9Dialect();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,16 +23,12 @@
|
|||
*/
|
||||
package org.hibernate.dialect;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.sql.Types;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.sql.CaseFragment;
|
||||
import org.hibernate.sql.DecodeCaseFragment;
|
||||
import org.hibernate.sql.JoinFragment;
|
||||
import org.hibernate.sql.OracleJoinFragment;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* An SQL dialect for Oracle, compatible with Oracle 8.
|
||||
|
@ -121,15 +117,4 @@ public class OracleDialect extends Oracle9Dialect {
|
|||
public String getCurrentTimestampSQLFunctionName() {
|
||||
return "sysdate";
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "The OracleDialect dialect has been deprecated; use Oracle8iDialect instead" )
|
||||
void deprecatedOracleDialect();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
*/
|
||||
package org.hibernate.dialect;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import java.sql.Types;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.dialect.function.NoArgSQLFunction;
|
||||
import org.hibernate.dialect.function.SQLFunctionTemplate;
|
||||
import org.hibernate.dialect.function.StandardSQLFunction;
|
||||
|
@ -41,10 +41,6 @@ import org.hibernate.persister.entity.Lockable;
|
|||
import org.hibernate.sql.CaseFragment;
|
||||
import org.hibernate.sql.DecodeCaseFragment;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* This is the Hibernate dialect for the Unisys 2200 Relational Database (RDMS).
|
||||
|
@ -365,15 +361,4 @@ public class RDMSOS2200Dialect extends Dialect {
|
|||
return new SelectLockingStrategy( lockable, lockMode );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "RDMSOS2200Dialect version: 1.0" )
|
||||
void rdmsOs2200Dialect();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,14 +23,10 @@
|
|||
*/
|
||||
package org.hibernate.dialect.function;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Delegate for handling function "templates".
|
||||
|
@ -119,16 +115,4 @@ public class TemplateRenderer {
|
|||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Function template anticipated %d arguments, but %d arguments encountered" )
|
||||
void missingArguments( int anticipatedNumberOfArguments,
|
||||
int numberOfArguments );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
/*
|
||||
* JBoss, Home of Professional Open Source.
|
||||
*
|
||||
* See the LEGAL.txt file distributed with this work for information regarding copyright ownership and licensing.
|
||||
*
|
||||
* See the AUTHORS.txt file distributed with this work for a full listing of individual contributors.
|
||||
*/
|
||||
package org.hibernate.dialect.lock;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Write locks via update not supported for non-versioned entities [%s]" )
|
||||
void writeLocksNotSupported( String entityName );
|
||||
}
|
|
@ -29,6 +29,7 @@ import java.sql.SQLException;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.PessimisticLockException;
|
||||
import org.hibernate.StaleObjectStateException;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.sql.SQLException;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.PessimisticLockException;
|
||||
import org.hibernate.StaleObjectStateException;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
|
|
|
@ -29,6 +29,7 @@ import java.sql.SQLException;
|
|||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.StaleObjectStateException;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
|
|
|
@ -23,17 +23,13 @@
|
|||
*/
|
||||
package org.hibernate.dialect.resolver;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.cfg.CollectionSecondPass;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.exception.JDBCConnectionException;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
import org.hibernate.service.jdbc.dialect.spi.DialectResolver;
|
||||
|
||||
/**
|
||||
* A templated resolver impl which delegates to the {@link #resolveDialectInternal} method
|
||||
|
@ -76,21 +72,4 @@ public abstract class AbstractDialectResolver implements DialectResolver {
|
|||
* @throws SQLException Indicates problems accessing the metadata.
|
||||
*/
|
||||
protected abstract Dialect resolveDialectInternal(DatabaseMetaData metaData) throws SQLException;
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Error executing resolver [%s] : %s" )
|
||||
void unableToExecuteResolver( AbstractDialectResolver abstractDialectResolver,
|
||||
String message );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "%s : %s" )
|
||||
void unableToQueryDatabaseMetadata( String message,
|
||||
String errorMessage );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,11 +25,9 @@ package org.hibernate.dialect.resolver;
|
|||
|
||||
import java.sql.SQLException;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.exception.SQLStateConverter;
|
||||
import org.hibernate.exception.ViolatedConstraintNameExtracter;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* A helper to centralize conversion of {@link java.sql.SQLException}s to {@link org.hibernate.JDBCException}s.
|
||||
|
@ -63,14 +61,4 @@ public class BasicSQLExceptionConverter {
|
|||
return "???";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@Message( value = "Unable to query java.sql.DatabaseMetaData" )
|
||||
String unableToQueryDatabaseMetadata();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,19 +23,15 @@
|
|||
*/
|
||||
package org.hibernate.dialect.resolver;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Properties;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.util.ReflectHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* A factory for generating Dialect instances.
|
||||
|
@ -163,19 +159,4 @@ public class DialectFactory {
|
|||
throw new HibernateException( "Could not instantiate dialect class", e );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Dialect resolver class not found: %s" )
|
||||
void dialectResolverNotFound( String resolverName );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Could not instantiate dialect resolver class : %s" )
|
||||
void unableToInstantiateDialectResolver( String message );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.dialect.resolver;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
@ -31,10 +30,7 @@ import java.util.List;
|
|||
import org.hibernate.cfg.CollectionSecondPass;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.exception.JDBCConnectionException;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
import org.hibernate.service.jdbc.dialect.spi.DialectResolver;
|
||||
|
||||
/**
|
||||
* A {@link DialectResolver} implementation which coordinates resolution by delegating to its
|
||||
|
@ -92,15 +88,4 @@ public class DialectResolverSet implements DialectResolver {
|
|||
public void addResolverAtFirst(DialectResolver resolver) {
|
||||
resolvers.add( 0, resolver );
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "sub-resolver threw unexpected exception, continuing to next : %s" )
|
||||
void subResolverException( String message );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,9 @@
|
|||
*/
|
||||
package org.hibernate.dialect.resolver;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.dialect.DB2Dialect;
|
||||
import org.hibernate.dialect.DerbyDialect;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
|
@ -43,10 +43,6 @@ import org.hibernate.dialect.PostgreSQLDialect;
|
|||
import org.hibernate.dialect.SQLServerDialect;
|
||||
import org.hibernate.dialect.SybaseASE15Dialect;
|
||||
import org.hibernate.dialect.SybaseAnywhereDialect;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* The standard Hibernate resolver.
|
||||
|
@ -138,27 +134,4 @@ public class StandardDialectResolver extends AbstractDialectResolver{
|
|||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Unknown Ingres major version [%s]; using Ingres 9.2 dialect" )
|
||||
void unknownIngresVersion( int databaseMajorVersion );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Unknown Oracle major version [%s]" )
|
||||
void unknownOracleVersion( int databaseMajorVersion );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Ingres 10 is not yet fully supported; using Ingres 9.3 dialect" )
|
||||
void unsupportedIngresVersion();
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Oracle 11g is not yet fully supported; using Oracle 10g dialect" )
|
||||
void unsupportedOracleVersion();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.engine;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.ERROR;
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
@ -38,6 +35,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.action.AfterTransactionCompletionProcess;
|
||||
import org.hibernate.action.BeforeTransactionCompletionProcess;
|
||||
import org.hibernate.action.BulkOperationCleanupAction;
|
||||
|
@ -51,10 +49,6 @@ import org.hibernate.action.EntityUpdateAction;
|
|||
import org.hibernate.action.Executable;
|
||||
import org.hibernate.cache.CacheException;
|
||||
import org.hibernate.type.Type;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Responsible for maintaining the queue of actions related to events.
|
||||
|
@ -253,7 +247,7 @@ public class ActionQueue {
|
|||
final Serializable[] spaces = action.getPropertySpaces();
|
||||
for ( Serializable space : spaces ) {
|
||||
if ( tableSpaces.contains( space ) ) {
|
||||
LOG.changesMustBeFlushed(space);
|
||||
LOG.debug("Changes must be flushed to space: " + space);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -415,45 +409,45 @@ public class ActionQueue {
|
|||
* @throws IOException Indicates an error writing to the stream
|
||||
*/
|
||||
public void serialize(ObjectOutputStream oos) throws IOException {
|
||||
LOG.serializingActionQueue();
|
||||
LOG.trace("Serializing action-queue");
|
||||
|
||||
int queueSize = insertions.size();
|
||||
LOG.serializingInsertions(queueSize);
|
||||
LOG.trace("Starting serialization of [" + queueSize + "] insertions entries");
|
||||
oos.writeInt( queueSize );
|
||||
for ( int i = 0; i < queueSize; i++ ) {
|
||||
oos.writeObject( insertions.get( i ) );
|
||||
}
|
||||
|
||||
queueSize = deletions.size();
|
||||
LOG.serializingDeletions(queueSize);
|
||||
LOG.trace("Starting serialization of [" + queueSize + "] deletions entries");
|
||||
oos.writeInt( queueSize );
|
||||
for ( int i = 0; i < queueSize; i++ ) {
|
||||
oos.writeObject( deletions.get( i ) );
|
||||
}
|
||||
|
||||
queueSize = updates.size();
|
||||
LOG.serializingUpdates(queueSize);
|
||||
LOG.trace("Starting serialization of [" + queueSize + "] updates entries");
|
||||
oos.writeInt( queueSize );
|
||||
for ( int i = 0; i < queueSize; i++ ) {
|
||||
oos.writeObject( updates.get( i ) );
|
||||
}
|
||||
|
||||
queueSize = collectionUpdates.size();
|
||||
LOG.serializingCollectionUpdates(queueSize);
|
||||
LOG.trace("Starting serialization of [" + queueSize + "] collectionUpdates entries");
|
||||
oos.writeInt( queueSize );
|
||||
for ( int i = 0; i < queueSize; i++ ) {
|
||||
oos.writeObject( collectionUpdates.get( i ) );
|
||||
}
|
||||
|
||||
queueSize = collectionRemovals.size();
|
||||
LOG.serializingCollectionRemovals(queueSize);
|
||||
LOG.trace("Starting serialization of [" + queueSize + "] collectionRemovals entries");
|
||||
oos.writeInt( queueSize );
|
||||
for ( int i = 0; i < queueSize; i++ ) {
|
||||
oos.writeObject( collectionRemovals.get( i ) );
|
||||
}
|
||||
|
||||
queueSize = collectionCreations.size();
|
||||
LOG.serializingCollectionCreations(queueSize);
|
||||
LOG.trace("Starting serialization of [" + queueSize + "] collectionCreations entries");
|
||||
oos.writeInt( queueSize );
|
||||
for ( int i = 0; i < queueSize; i++ ) {
|
||||
oos.writeObject( collectionCreations.get( i ) );
|
||||
|
@ -476,46 +470,46 @@ public class ActionQueue {
|
|||
public static ActionQueue deserialize(
|
||||
ObjectInputStream ois,
|
||||
SessionImplementor session) throws IOException, ClassNotFoundException {
|
||||
LOG.deserializingActionQueue();
|
||||
LOG.trace("Dedeserializing action-queue");
|
||||
ActionQueue rtn = new ActionQueue( session );
|
||||
|
||||
int queueSize = ois.readInt();
|
||||
LOG.deserializingInsertions(queueSize);
|
||||
LOG.trace("Starting deserialization of [" + queueSize + "] insertions entries");
|
||||
rtn.insertions = new ArrayList<Executable>( queueSize );
|
||||
for ( int i = 0; i < queueSize; i++ ) {
|
||||
rtn.insertions.add( ois.readObject() );
|
||||
}
|
||||
|
||||
queueSize = ois.readInt();
|
||||
LOG.deserializingDeletions(queueSize);
|
||||
LOG.trace("Starting deserialization of [" + queueSize + "] deletions entries");
|
||||
rtn.deletions = new ArrayList<Executable>( queueSize );
|
||||
for ( int i = 0; i < queueSize; i++ ) {
|
||||
rtn.deletions.add( ois.readObject() );
|
||||
}
|
||||
|
||||
queueSize = ois.readInt();
|
||||
LOG.deserializingUpdates(queueSize);
|
||||
LOG.trace("Starting deserialization of [" + queueSize + "] updates entries");
|
||||
rtn.updates = new ArrayList<Executable>( queueSize );
|
||||
for ( int i = 0; i < queueSize; i++ ) {
|
||||
rtn.updates.add( ois.readObject() );
|
||||
}
|
||||
|
||||
queueSize = ois.readInt();
|
||||
LOG.deserializingCollectionUpdates(queueSize);
|
||||
LOG.trace("Starting deserialization of [" + queueSize + "] collectionUpdates entries");
|
||||
rtn.collectionUpdates = new ArrayList<Executable>( queueSize );
|
||||
for ( int i = 0; i < queueSize; i++ ) {
|
||||
rtn.collectionUpdates.add( ois.readObject() );
|
||||
}
|
||||
|
||||
queueSize = ois.readInt();
|
||||
LOG.deserializingCollectionRemovals(queueSize);
|
||||
LOG.trace("Starting deserialization of [" + queueSize + "] collectionRemovals entries");
|
||||
rtn.collectionRemovals = new ArrayList<Executable>( queueSize );
|
||||
for ( int i = 0; i < queueSize; i++ ) {
|
||||
rtn.collectionRemovals.add( ois.readObject() );
|
||||
}
|
||||
|
||||
queueSize = ois.readInt();
|
||||
LOG.deserializingCollectionCreations(queueSize);
|
||||
LOG.trace("Starting deserialization of [" + queueSize + "] collectionCreations entries");
|
||||
rtn.collectionCreations = new ArrayList<Executable>( queueSize );
|
||||
for ( int i = 0; i < queueSize; i++ ) {
|
||||
rtn.collectionCreations.add( ois.readObject() );
|
||||
|
@ -732,75 +726,4 @@ public class ActionQueue {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Changes must be flushed to space: %s" )
|
||||
void changesMustBeFlushed( Serializable space );
|
||||
|
||||
@LogMessage( level = ERROR )
|
||||
@Message( value = "Could not release a cache lock : %s" )
|
||||
void unableToReleaseCacheLock( CacheException ce );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Dedeserializing action-queue" )
|
||||
void deserializingActionQueue();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting deserialization of [%d] collectionCreations entries" )
|
||||
void deserializingCollectionCreations( int queueSize );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting deserialization of [%d] collectionRemovals entries" )
|
||||
void deserializingCollectionRemovals( int queueSize );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting deserialization of [%d] collectionUpdates entries" )
|
||||
void deserializingCollectionUpdates( int queueSize );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting deserialization of [%d] deletions entries" )
|
||||
void deserializingDeletions( int queueSize );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting deserialization of [%d] insertions entries" )
|
||||
void deserializingInsertions( int queueSize );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting deserialization of [%d] updates entries" )
|
||||
void deserializingUpdates( int queueSize );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Serializing action-queue" )
|
||||
void serializingActionQueue();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting serialization of [%d] collectionCreations entries" )
|
||||
void serializingCollectionCreations( int queueSize );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting serialization of [%d] collectionRemovals entries" )
|
||||
void serializingCollectionRemovals( int queueSize );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting serialization of [%d] collectionUpdates entries" )
|
||||
void serializingCollectionUpdates( int queueSize );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting serialization of [%d] deletions entries" )
|
||||
void serializingDeletions( int queueSize );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting serialization of [%d] insertions entries" )
|
||||
void serializingInsertions( int queueSize );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting serialization of [%d] updates entries" )
|
||||
void serializingUpdates( int queueSize );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.engine;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
@ -31,6 +30,7 @@ import java.util.Iterator;
|
|||
import java.util.Stack;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.collection.PersistentCollection;
|
||||
import org.hibernate.event.EventSource;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
|
@ -42,10 +42,6 @@ import org.hibernate.type.CompositeType;
|
|||
import org.hibernate.type.EntityType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.util.CollectionHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Delegate responsible for, in conjunction with the various
|
||||
|
@ -142,7 +138,7 @@ public final class Cascade {
|
|||
throws HibernateException {
|
||||
|
||||
if ( persister.hasCascades() || action.requiresNoCascadeChecking() ) { // performance opt
|
||||
LOG.processingCascade(action, persister.getEntityName());
|
||||
LOG.trace("Processing cascade " + action + " for: " + persister.getEntityName());
|
||||
|
||||
Type[] types = persister.getPropertyTypes();
|
||||
CascadeStyle[] cascadeStyles = persister.getPropertyCascadeStyles();
|
||||
|
@ -178,7 +174,7 @@ public final class Cascade {
|
|||
}
|
||||
}
|
||||
|
||||
LOG.processingCascadeEnded(action, persister.getEntityName());
|
||||
LOG.trace("Done processing cascade " + action + " for: " + persister.getEntityName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -250,7 +246,7 @@ public final class Cascade {
|
|||
if (LOG.isTraceEnabled()) {
|
||||
final Serializable id = entry.getPersister().getIdentifier( loadedValue, eventSource );
|
||||
final String description = MessageHelper.infoString( entityName, id );
|
||||
LOG.deletingOrphanedEntity(description);
|
||||
LOG.trace("Deleting orphaned entity instance: " + description);
|
||||
}
|
||||
eventSource.delete( entityName, loadedValue, false, new HashSet() );
|
||||
}
|
||||
|
@ -413,7 +409,7 @@ public final class Cascade {
|
|||
embeddedElements && child!=CollectionType.UNFETCHED_COLLECTION;
|
||||
|
||||
if ( reallyDoCascade ) {
|
||||
LOG.cascadeActionForCollection(action, collectionType.getRole());
|
||||
LOG.trace("Cascade " + action + " for collection: " + collectionType.getRole());
|
||||
|
||||
Iterator iter = action.getCascadableChildrenIterator(eventSource, collectionType, child);
|
||||
while ( iter.hasNext() ) {
|
||||
|
@ -428,7 +424,7 @@ public final class Cascade {
|
|||
);
|
||||
}
|
||||
|
||||
LOG.cascadeActionForColectionEnded(action, collectionType.getRole());
|
||||
LOG.trace("Done cascade " + action + " for collection: " + collectionType.getRole());
|
||||
}
|
||||
|
||||
final boolean deleteOrphans = style.hasOrphanDelete() &&
|
||||
|
@ -437,7 +433,7 @@ public final class Cascade {
|
|||
child instanceof PersistentCollection; //a newly instantiated collection can't have orphans
|
||||
|
||||
if ( deleteOrphans ) { // handle orphaned entities!!
|
||||
LOG.deletingOrphansForCollection(collectionType.getRole());
|
||||
LOG.trace("Deleting orphans for collection: " + collectionType.getRole());
|
||||
|
||||
// we can do the cast since orphan-delete does not apply to:
|
||||
// 1. newly instantiated collections
|
||||
|
@ -445,7 +441,7 @@ public final class Cascade {
|
|||
final String entityName = collectionType.getAssociatedEntityName( eventSource.getFactory() );
|
||||
deleteOrphans( entityName, (PersistentCollection) child );
|
||||
|
||||
LOG.deletingOrphansForCollectionEnded(collectionType.getRole());
|
||||
LOG.trace("Done deleting orphans for collection: " + collectionType.getRole());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -469,48 +465,9 @@ public final class Cascade {
|
|||
while ( orphanIter.hasNext() ) {
|
||||
Object orphan = orphanIter.next();
|
||||
if (orphan!=null) {
|
||||
LOG.deletingOrphanedEntity(entityName);
|
||||
LOG.trace("Deleting orphaned entity instance: " + entityName);
|
||||
eventSource.delete( entityName, orphan, false, new HashSet() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Cascade %s for collection: %s" )
|
||||
void cascadeActionForCollection( CascadingAction action,
|
||||
String role );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Done cascade %s for collection: %s" )
|
||||
void cascadeActionForColectionEnded( CascadingAction action,
|
||||
String role );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Deleting orphaned entity instance: %s" )
|
||||
void deletingOrphanedEntity( String description );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Deleting orphans for collection: %s" )
|
||||
void deletingOrphansForCollection( String role );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Done deleting orphans for collection: %s" )
|
||||
void deletingOrphansForCollectionEnded( String role );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Processing cascade %s for: %s" )
|
||||
void processingCascade( CascadingAction action,
|
||||
String entityName );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Done processing cascade %s for: %s" )
|
||||
void processingCascadeEnded( CascadingAction action,
|
||||
String entityName );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,13 +24,13 @@
|
|||
*/
|
||||
package org.hibernate.engine;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.ReplicationMode;
|
||||
import org.hibernate.TransientObjectException;
|
||||
import org.hibernate.collection.PersistentCollection;
|
||||
|
@ -40,10 +40,6 @@ import org.hibernate.proxy.HibernateProxy;
|
|||
import org.hibernate.type.CollectionType;
|
||||
import org.hibernate.type.EntityType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* A session action that may be cascaded from parent entity to its children
|
||||
|
@ -143,7 +139,7 @@ public abstract class CascadingAction {
|
|||
@Override
|
||||
public void cascade(EventSource session, Object child, String entityName, Object anything, boolean isCascadeDeleteEnabled)
|
||||
throws HibernateException {
|
||||
LOG.cascadingToDelete(entityName);
|
||||
LOG.trace("Cascading to delete: " + entityName);
|
||||
session.delete( entityName, child, isCascadeDeleteEnabled, ( Set ) anything );
|
||||
}
|
||||
@Override
|
||||
|
@ -169,7 +165,7 @@ public abstract class CascadingAction {
|
|||
@Override
|
||||
public void cascade(EventSource session, Object child, String entityName, Object anything, boolean isCascadeDeleteEnabled)
|
||||
throws HibernateException {
|
||||
LOG.cascadingToLock(entityName);
|
||||
LOG.trace("Cascading to lock: " + entityName);
|
||||
LockMode lockMode = LockMode.NONE;
|
||||
LockOptions lr = new LockOptions();
|
||||
if ( anything instanceof LockOptions) {
|
||||
|
@ -205,7 +201,7 @@ public abstract class CascadingAction {
|
|||
@Override
|
||||
public void cascade(EventSource session, Object child, String entityName, Object anything, boolean isCascadeDeleteEnabled)
|
||||
throws HibernateException {
|
||||
LOG.cascadingToRefresh(entityName);
|
||||
LOG.trace("Cascading to refresh: " + entityName);
|
||||
session.refresh( child, (Map) anything );
|
||||
}
|
||||
@Override
|
||||
|
@ -230,7 +226,7 @@ public abstract class CascadingAction {
|
|||
@Override
|
||||
public void cascade(EventSource session, Object child, String entityName, Object anything, boolean isCascadeDeleteEnabled)
|
||||
throws HibernateException {
|
||||
LOG.cascadingToEvict(entityName);
|
||||
LOG.trace("Cascading to evict: " + entityName);
|
||||
session.evict(child);
|
||||
}
|
||||
@Override
|
||||
|
@ -259,7 +255,7 @@ public abstract class CascadingAction {
|
|||
@Override
|
||||
public void cascade(EventSource session, Object child, String entityName, Object anything, boolean isCascadeDeleteEnabled)
|
||||
throws HibernateException {
|
||||
LOG.cascadingToSaveOrUpdate(entityName);
|
||||
LOG.trace("Cascading to save or update: " + entityName);
|
||||
session.saveOrUpdate(entityName, child);
|
||||
}
|
||||
@Override
|
||||
|
@ -289,7 +285,7 @@ public abstract class CascadingAction {
|
|||
@Override
|
||||
public void cascade(EventSource session, Object child, String entityName, Object anything, boolean isCascadeDeleteEnabled)
|
||||
throws HibernateException {
|
||||
LOG.cascadingToMerge(entityName);
|
||||
LOG.trace("Cascading to merge: " + entityName);
|
||||
session.merge( entityName, child, (Map) anything );
|
||||
}
|
||||
@Override
|
||||
|
@ -317,7 +313,7 @@ public abstract class CascadingAction {
|
|||
@Override
|
||||
public void cascade(EventSource session, Object child, String entityName, Object anything, boolean isCascadeDeleteEnabled)
|
||||
throws HibernateException {
|
||||
LOG.cascadingToSaveOrUpdateCopy(entityName);
|
||||
LOG.trace("Cascading to save or update copy: " + entityName);
|
||||
session.saveOrUpdateCopy( entityName, child, (Map) anything );
|
||||
}
|
||||
@Override
|
||||
|
@ -343,7 +339,7 @@ public abstract class CascadingAction {
|
|||
@Override
|
||||
public void cascade(EventSource session, Object child, String entityName, Object anything, boolean isCascadeDeleteEnabled)
|
||||
throws HibernateException {
|
||||
LOG.cascadingToPersist(entityName);
|
||||
LOG.trace("Cascading to persist: " + entityName);
|
||||
session.persist( entityName, child, (Map) anything );
|
||||
}
|
||||
@Override
|
||||
|
@ -374,7 +370,7 @@ public abstract class CascadingAction {
|
|||
@Override
|
||||
public void cascade(EventSource session, Object child, String entityName, Object anything, boolean isCascadeDeleteEnabled)
|
||||
throws HibernateException {
|
||||
LOG.cascadingToPersistOnFlush(entityName);
|
||||
LOG.trace("Cascading to persist on flush: " + entityName);
|
||||
session.persistOnFlush( entityName, child, (Map) anything );
|
||||
}
|
||||
@Override
|
||||
|
@ -441,7 +437,7 @@ public abstract class CascadingAction {
|
|||
@Override
|
||||
public void cascade(EventSource session, Object child, String entityName, Object anything, boolean isCascadeDeleteEnabled)
|
||||
throws HibernateException {
|
||||
LOG.cascadingToReplicate(entityName);
|
||||
LOG.trace("Cascading to replicate: " + entityName);
|
||||
session.replicate( entityName, child, (ReplicationMode) anything );
|
||||
}
|
||||
@Override
|
||||
|
@ -497,51 +493,4 @@ public abstract class CascadingAction {
|
|||
private static boolean collectionIsInitialized(Object collection) {
|
||||
return !(collection instanceof PersistentCollection) || ( (PersistentCollection) collection ).wasInitialized();
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Cascading to delete: %s" )
|
||||
void cascadingToDelete( String entityName );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Cascading to evict: %s" )
|
||||
void cascadingToEvict( String entityName );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Cascading to lock: %s" )
|
||||
void cascadingToLock( String entityName );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Cascading to merge: %s" )
|
||||
void cascadingToMerge( String entityName );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Cascading to persist: %s" )
|
||||
void cascadingToPersist( String entityName );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Cascading to persist on flush: %s" )
|
||||
void cascadingToPersistOnFlush( String entityName );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Cascading to refresh: %s" )
|
||||
void cascadingToRefresh( String entityName );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Cascading to replicate: %s" )
|
||||
void cascadingToReplicate( String entityName );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Cascading to save or update: %s" )
|
||||
void cascadingToSaveOrUpdate( String entityName );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Cascading to save or update copy: %s" )
|
||||
void cascadingToSaveOrUpdateCopy( String entityName );
|
||||
}
|
||||
}
|
|
@ -24,7 +24,6 @@
|
|||
*/
|
||||
package org.hibernate.engine;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
@ -32,14 +31,11 @@ import java.io.Serializable;
|
|||
import java.util.Collection;
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.collection.PersistentCollection;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* We need an entry to tell us all about the current state
|
||||
|
@ -199,8 +195,9 @@ public final class CollectionEntry implements Serializable {
|
|||
|
||||
dirty(collection);
|
||||
|
||||
if (LOG.isDebugEnabled() && collection.isDirty() && getLoadedPersister() != null) LOG.collectionDirty(MessageHelper.collectionInfoString(getLoadedPersister().getRole(),
|
||||
getLoadedKey()));
|
||||
if (LOG.isDebugEnabled() && collection.isDirty() && getLoadedPersister() != null) LOG.debug("Collection dirty: "
|
||||
+ MessageHelper.collectionInfoString(getLoadedPersister().getRole(),
|
||||
getLoadedKey()));
|
||||
|
||||
setDoupdate(false);
|
||||
setDoremove(false);
|
||||
|
@ -417,15 +414,4 @@ public final class CollectionEntry implements Serializable {
|
|||
( session == null ? null : session.getFactory() )
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Collection dirty: %s" )
|
||||
void collectionDirty( String collectionInfoString );
|
||||
}
|
||||
}
|
|
@ -24,20 +24,15 @@
|
|||
*/
|
||||
package org.hibernate.engine;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import java.io.Serializable;
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.collection.PersistentCollection;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.hibernate.type.CollectionType;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Implements book-keeping for the collection persistence by reachability algorithm
|
||||
|
@ -75,9 +70,10 @@ public final class Collections {
|
|||
CollectionEntry entry = persistenceContext.getCollectionEntry(coll);
|
||||
final CollectionPersister loadedPersister = entry.getLoadedPersister();
|
||||
|
||||
if (LOG.isDebugEnabled() && loadedPersister != null) LOG.collectionDereferenced(MessageHelper.collectionInfoString(loadedPersister,
|
||||
entry.getLoadedKey(),
|
||||
session.getFactory()));
|
||||
if (LOG.isDebugEnabled() && loadedPersister != null) LOG.debug("Collection dereferenced: "
|
||||
+ MessageHelper.collectionInfoString(loadedPersister,
|
||||
entry.getLoadedKey(),
|
||||
session.getFactory()));
|
||||
|
||||
// do a check
|
||||
boolean hasOrphanDelete = loadedPersister != null &&
|
||||
|
@ -133,9 +129,8 @@ public final class Collections {
|
|||
final PersistenceContext persistenceContext = session.getPersistenceContext();
|
||||
CollectionEntry entry = persistenceContext.getCollectionEntry(coll);
|
||||
|
||||
LOG.foundCollectionWithUnloadedOwner(MessageHelper.collectionInfoString(entry.getLoadedPersister(),
|
||||
entry.getLoadedKey(),
|
||||
session.getFactory()));
|
||||
LOG.debug("Found collection with unloaded owner: "
|
||||
+ MessageHelper.collectionInfoString(entry.getLoadedPersister(), entry.getLoadedKey(), session.getFactory()));
|
||||
|
||||
entry.setCurrentPersister( entry.getLoadedPersister() );
|
||||
entry.setCurrentKey( entry.getLoadedKey() );
|
||||
|
@ -146,7 +141,7 @@ public final class Collections {
|
|||
|
||||
/**
|
||||
* Initialize the role of the collection.
|
||||
*
|
||||
*
|
||||
* @param collection The collection to be updated by reachability.
|
||||
* @param type The type of the collection.
|
||||
* @param entity The owner of the collection.
|
||||
|
@ -188,16 +183,15 @@ public final class Collections {
|
|||
ce.setCurrentKey( type.getKeyOfOwner(entity, session) ); //TODO: better to pass the id in as an argument?
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
if (collection.wasInitialized()) LOG.collectionFound(MessageHelper.collectionInfoString(persister,
|
||||
ce.getCurrentKey(),
|
||||
factory),
|
||||
MessageHelper.collectionInfoString(ce.getLoadedPersister(),
|
||||
ce.getLoadedKey(),
|
||||
factory),
|
||||
LOG.initialized());
|
||||
else LOG.collectionFound(MessageHelper.collectionInfoString(persister, ce.getCurrentKey(), factory),
|
||||
MessageHelper.collectionInfoString(ce.getLoadedPersister(), ce.getLoadedKey(), factory),
|
||||
LOG.uninitialized());
|
||||
if (collection.wasInitialized()) LOG.debug("Collection found: "
|
||||
+ MessageHelper.collectionInfoString(persister, ce.getCurrentKey(), factory)
|
||||
+ ", was: "
|
||||
+ MessageHelper.collectionInfoString(ce.getLoadedPersister(),
|
||||
ce.getLoadedKey(),
|
||||
factory) + " (initialized)");
|
||||
else LOG.debug("Collection found: " + MessageHelper.collectionInfoString(persister, ce.getCurrentKey(), factory)
|
||||
+ ", was: " + MessageHelper.collectionInfoString(ce.getLoadedPersister(), ce.getLoadedKey(), factory)
|
||||
+ " (uninitialized)");
|
||||
}
|
||||
|
||||
prepareCollectionForUpdate( collection, ce, session.getEntityMode(), factory );
|
||||
|
@ -255,7 +249,7 @@ public final class Collections {
|
|||
if ( loadedPersister != null ) {
|
||||
entry.setDoremove(true); // we will need to remove ye olde entries
|
||||
if ( entry.isDorecreate() ) {
|
||||
LOG.forcingCollectionInitialization();
|
||||
LOG.trace("Forcing collection initialization");
|
||||
collection.forceInitialization(); // force initialize!
|
||||
}
|
||||
}
|
||||
|
@ -268,35 +262,4 @@ public final class Collections {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Collection dereferenced: %s" )
|
||||
void collectionDereferenced( String collectionInfoString );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Collection found: %s, was: %s (%s)" )
|
||||
void collectionFound( String collectionInfoString,
|
||||
String collectionInfoString2,
|
||||
String initialized );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Forcing collection initialization" )
|
||||
void forcingCollectionInitialization();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Found collection with unloaded owner: %s" )
|
||||
void foundCollectionWithUnloadedOwner( String collectionInfoString );
|
||||
|
||||
@Message( value = "initialized" )
|
||||
String initialized();
|
||||
|
||||
@Message( value = "uninitialized" )
|
||||
String uninitialized();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,12 +24,8 @@
|
|||
*/
|
||||
package org.hibernate.engine;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import java.io.Serializable;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
import org.hibernate.Logger;
|
||||
|
||||
/**
|
||||
* A strategy for determining if an identifier value is an identifier of
|
||||
|
@ -52,7 +48,7 @@ public class IdentifierValue {
|
|||
public static final IdentifierValue ANY = new IdentifierValue() {
|
||||
@Override
|
||||
public final Boolean isUnsaved(Serializable id) {
|
||||
LOG.idUnsavedValueStrategy("ANY");
|
||||
LOG.trace("ID unsaved-value strategy ANY");
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
@Override
|
||||
|
@ -71,7 +67,7 @@ public class IdentifierValue {
|
|||
public static final IdentifierValue NONE = new IdentifierValue() {
|
||||
@Override
|
||||
public final Boolean isUnsaved(Serializable id) {
|
||||
LOG.idUnsavedValueStrategy("NONE");
|
||||
LOG.trace("ID unsaved-value strategy NONE");
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
@Override
|
||||
|
@ -91,7 +87,7 @@ public class IdentifierValue {
|
|||
public static final IdentifierValue NULL = new IdentifierValue() {
|
||||
@Override
|
||||
public final Boolean isUnsaved(Serializable id) {
|
||||
LOG.idUnsavedValueStrategy("NULL");
|
||||
LOG.trace("ID unsaved-value strategy NULL");
|
||||
return id==null ? Boolean.TRUE : Boolean.FALSE;
|
||||
}
|
||||
@Override
|
||||
|
@ -110,7 +106,7 @@ public class IdentifierValue {
|
|||
public static final IdentifierValue UNDEFINED = new IdentifierValue() {
|
||||
@Override
|
||||
public final Boolean isUnsaved(Serializable id) {
|
||||
LOG.idUnsavedValueStrategy("UNDEFINED");
|
||||
LOG.trace("ID unsaved-value strategy UNDEFINED");
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
|
@ -139,7 +135,7 @@ public class IdentifierValue {
|
|||
* Does the given identifier belong to a new instance?
|
||||
*/
|
||||
public Boolean isUnsaved(Serializable id) {
|
||||
LOG.idUnsavedValue(value);
|
||||
LOG.trace("ID unsaved-value: " + value);
|
||||
return id==null || id.equals(value) ? Boolean.TRUE : Boolean.FALSE;
|
||||
}
|
||||
|
||||
|
@ -151,19 +147,4 @@ public class IdentifierValue {
|
|||
public String toString() {
|
||||
return "identifier unsaved-value: " + value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "ID unsaved-value: %s" )
|
||||
void idUnsavedValue( Serializable value );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "ID unsaved-value strategy %s" )
|
||||
void idUnsavedValueStrategy( String name );
|
||||
}
|
||||
}
|
|
@ -24,17 +24,13 @@
|
|||
*/
|
||||
package org.hibernate.engine;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.type.Type;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Centralizes the commonality regarding binding of parameter values into
|
||||
|
@ -122,7 +118,7 @@ public class ParameterBinder {
|
|||
TypedValue typedval = ( TypedValue ) e.getValue();
|
||||
int[] locations = source.getNamedParameterLocations( name );
|
||||
for ( int i = 0; i < locations.length; i++ ) {
|
||||
LOG.bindNamedParameters(typedval.getValue(), name, locations[i] + start);
|
||||
LOG.debug("bindNamedParameters() " + typedval.getValue() + " -> " + name + " [" + (locations[i] + start) + "]");
|
||||
typedval.getType().nullSafeSet( ps, typedval.getValue(), locations[i] + start, session );
|
||||
}
|
||||
result += locations.length;
|
||||
|
@ -131,17 +127,4 @@ public class ParameterBinder {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "bindNamedParameters() %s -> %s [%d]" )
|
||||
void bindNamedParameters( Object value,
|
||||
String name,
|
||||
int i );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
*/
|
||||
package org.hibernate.engine;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
@ -34,6 +33,7 @@ import java.util.Map;
|
|||
import java.util.StringTokenizer;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.ScrollMode;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
|
@ -43,10 +43,6 @@ import org.hibernate.pretty.Printer;
|
|||
import org.hibernate.transform.ResultTransformer;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.util.ArrayHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* @author Gavin King
|
||||
|
@ -281,9 +277,9 @@ public final class QueryParameters {
|
|||
|
||||
public void traceParameters(SessionFactoryImplementor factory) throws HibernateException {
|
||||
Printer print = new Printer( factory );
|
||||
if (positionalParameterValues.length != 0) LOG.parameters(print.toString(positionalParameterTypes,
|
||||
positionalParameterValues));
|
||||
if (namedParameters != null) LOG.namedParameters(print.toString(namedParameters));
|
||||
if (positionalParameterValues.length != 0) LOG.trace("Parameters: "
|
||||
+ print.toString(positionalParameterTypes, positionalParameterValues));
|
||||
if (namedParameters != null) LOG.trace("Named parameters: " + print.toString(namedParameters));
|
||||
}
|
||||
|
||||
public boolean isCacheable() {
|
||||
|
@ -563,19 +559,4 @@ public final class QueryParameters {
|
|||
copy.processedPositionalParameterValues = this.processedPositionalParameterValues;
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Named parameters: %s" )
|
||||
void namedParameters( String string );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Parameters: %s" )
|
||||
void parameters( String string );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
*/
|
||||
package org.hibernate.engine;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.io.IOException;
|
||||
import java.io.InvalidObjectException;
|
||||
|
@ -44,6 +42,7 @@ import org.hibernate.AssertionFailure;
|
|||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.NonUniqueObjectException;
|
||||
import org.hibernate.PersistentObjectException;
|
||||
|
@ -58,10 +57,6 @@ import org.hibernate.proxy.LazyInitializer;
|
|||
import org.hibernate.tuple.ElementWrapper;
|
||||
import org.hibernate.util.IdentityMap;
|
||||
import org.hibernate.util.MarkerObject;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* A <tt>PersistenceContext</tt> represents the state of persistent "stuff" which
|
||||
|
@ -553,7 +548,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
}
|
||||
|
||||
if ( value instanceof HibernateProxy ) {
|
||||
LOG.settingProxyIdentifier(id);
|
||||
LOG.debug("setting proxy identifier: " + id);
|
||||
HibernateProxy proxy = (HibernateProxy) value;
|
||||
LazyInitializer li = proxy.getHibernateLazyInitializer();
|
||||
li.setIdentifier(id);
|
||||
|
@ -889,7 +884,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
*/
|
||||
public void initializeNonLazyCollections() throws HibernateException {
|
||||
if ( loadCounter == 0 ) {
|
||||
LOG.initializingNonLazyCollections();
|
||||
LOG.debug("Initializing non-lazy collections");
|
||||
//do this work only at the very highest level of the load
|
||||
loadCounter++; //don't let this method be called recursively
|
||||
try {
|
||||
|
@ -1435,13 +1430,13 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
* @throws IOException serialization errors.
|
||||
*/
|
||||
public void serialize(ObjectOutputStream oos) throws IOException {
|
||||
LOG.serializingPersistentContext();
|
||||
LOG.trace("Serializing persistent-context");
|
||||
|
||||
oos.writeBoolean( defaultReadOnly );
|
||||
oos.writeBoolean( hasNonReadOnlyEntities );
|
||||
|
||||
oos.writeInt( entitiesByKey.size() );
|
||||
LOG.serializingEntitiesByKey(entitiesByKey.size());
|
||||
LOG.trace("Starting serialization of [" + entitiesByKey.size() + "] entitiesByKey entries");
|
||||
Iterator itr = entitiesByKey.entrySet().iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
Map.Entry entry = ( Map.Entry ) itr.next();
|
||||
|
@ -1450,7 +1445,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
}
|
||||
|
||||
oos.writeInt( entitiesByUniqueKey.size() );
|
||||
LOG.serializingEntitiesByUniqueKey(entitiesByUniqueKey.size());
|
||||
LOG.trace("Starting serialization of [" + entitiesByUniqueKey.size() + "] entitiesByUniqueKey entries");
|
||||
itr = entitiesByUniqueKey.entrySet().iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
Map.Entry entry = ( Map.Entry ) itr.next();
|
||||
|
@ -1459,7 +1454,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
}
|
||||
|
||||
oos.writeInt( proxiesByKey.size() );
|
||||
LOG.serializingProxiesByKey(proxiesByKey.size());
|
||||
LOG.trace("Starting serialization of [" + proxiesByKey.size() + "] proxiesByKey entries");
|
||||
itr = proxiesByKey.entrySet().iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
Map.Entry entry = ( Map.Entry ) itr.next();
|
||||
|
@ -1468,7 +1463,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
}
|
||||
|
||||
oos.writeInt( entitySnapshotsByKey.size() );
|
||||
LOG.serializingEntitySnapshotsByKey(entitySnapshotsByKey.size());
|
||||
LOG.trace("Starting serialization of [" + entitySnapshotsByKey.size() + "] entitySnapshotsByKey entries");
|
||||
itr = entitySnapshotsByKey.entrySet().iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
Map.Entry entry = ( Map.Entry ) itr.next();
|
||||
|
@ -1477,7 +1472,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
}
|
||||
|
||||
oos.writeInt( entityEntries.size() );
|
||||
LOG.serializingEntityEntries(entityEntries.size());
|
||||
LOG.trace("Starting serialization of [" + entityEntries.size() + "] entityEntries entries");
|
||||
itr = entityEntries.entrySet().iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
Map.Entry entry = ( Map.Entry ) itr.next();
|
||||
|
@ -1486,7 +1481,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
}
|
||||
|
||||
oos.writeInt( collectionsByKey.size() );
|
||||
LOG.serializingCollectionsByKey(collectionsByKey.size());
|
||||
LOG.trace("Starting serialization of [" + collectionsByKey.size() + "] collectionsByKey entries");
|
||||
itr = collectionsByKey.entrySet().iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
Map.Entry entry = ( Map.Entry ) itr.next();
|
||||
|
@ -1495,7 +1490,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
}
|
||||
|
||||
oos.writeInt( collectionEntries.size() );
|
||||
LOG.serializingCollectionEntries(collectionEntries.size());
|
||||
LOG.trace("Starting serialization of [" + collectionEntries.size() + "] collectionEntries entries");
|
||||
itr = collectionEntries.entrySet().iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
Map.Entry entry = ( Map.Entry ) itr.next();
|
||||
|
@ -1504,7 +1499,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
}
|
||||
|
||||
oos.writeInt( arrayHolders.size() );
|
||||
LOG.serializingArrayHolders(arrayHolders.size());
|
||||
LOG.trace("Starting serialization of [" + arrayHolders.size() + "] arrayHolders entries");
|
||||
itr = arrayHolders.entrySet().iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
Map.Entry entry = ( Map.Entry ) itr.next();
|
||||
|
@ -1513,7 +1508,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
}
|
||||
|
||||
oos.writeInt( nullifiableEntityKeys.size() );
|
||||
LOG.serializingNullifiableEntityKeys(nullifiableEntityKeys.size());
|
||||
LOG.trace("Starting serialization of [" + nullifiableEntityKeys.size() + "] nullifiableEntityKey entries");
|
||||
itr = nullifiableEntityKeys.iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
EntityKey entry = ( EntityKey ) itr.next();
|
||||
|
@ -1524,7 +1519,7 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
public static StatefulPersistenceContext deserialize(
|
||||
ObjectInputStream ois,
|
||||
SessionImplementor session) throws IOException, ClassNotFoundException {
|
||||
LOG.deserializingPersistentContext();
|
||||
LOG.trace("Serializing persistent-context");
|
||||
StatefulPersistenceContext rtn = new StatefulPersistenceContext( session );
|
||||
|
||||
// during deserialization, we need to reconnect all proxies and
|
||||
|
@ -1538,21 +1533,21 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
rtn.hasNonReadOnlyEntities = ois.readBoolean();
|
||||
|
||||
int count = ois.readInt();
|
||||
LOG.deserializingEntitiesByKey(count);
|
||||
LOG.trace("Starting deserialization of [" + count + "] entitiesByKey entries");
|
||||
rtn.entitiesByKey = new HashMap( count < INIT_COLL_SIZE ? INIT_COLL_SIZE : count );
|
||||
for ( int i = 0; i < count; i++ ) {
|
||||
rtn.entitiesByKey.put( EntityKey.deserialize( ois, session ), ois.readObject() );
|
||||
}
|
||||
|
||||
count = ois.readInt();
|
||||
LOG.deserializingEntitiesByUniqueKey(count);
|
||||
LOG.trace("Starting deserialization of [" + count + "] entitiesByUniqueKey entries");
|
||||
rtn.entitiesByUniqueKey = new HashMap( count < INIT_COLL_SIZE ? INIT_COLL_SIZE : count );
|
||||
for ( int i = 0; i < count; i++ ) {
|
||||
rtn.entitiesByUniqueKey.put( EntityUniqueKey.deserialize( ois, session ), ois.readObject() );
|
||||
}
|
||||
|
||||
count = ois.readInt();
|
||||
LOG.deserializingProxiesByKey(count);
|
||||
LOG.trace("Starting deserialization of [" + count + "] proxiesByKey entries");
|
||||
rtn.proxiesByKey = new ReferenceMap( AbstractReferenceMap.HARD, AbstractReferenceMap.WEAK, count < INIT_COLL_SIZE ? INIT_COLL_SIZE : count, .75f );
|
||||
for ( int i = 0; i < count; i++ ) {
|
||||
EntityKey ek = EntityKey.deserialize( ois, session );
|
||||
|
@ -1560,19 +1555,19 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
if ( proxy instanceof HibernateProxy ) {
|
||||
( ( HibernateProxy ) proxy ).getHibernateLazyInitializer().setSession( session );
|
||||
rtn.proxiesByKey.put( ek, proxy );
|
||||
} else LOG.encounteredPrunedProxy();
|
||||
} else LOG.trace("Encountered prunded proxy");
|
||||
// otherwise, the proxy was pruned during the serialization process
|
||||
}
|
||||
|
||||
count = ois.readInt();
|
||||
LOG.deserializingEntitySnapshotsByKey(count);
|
||||
LOG.trace("Starting deserialization of [" + count + "] entitySnapshotsByKey entries");
|
||||
rtn.entitySnapshotsByKey = new HashMap( count < INIT_COLL_SIZE ? INIT_COLL_SIZE : count );
|
||||
for ( int i = 0; i < count; i++ ) {
|
||||
rtn.entitySnapshotsByKey.put( EntityKey.deserialize( ois, session ), ois.readObject() );
|
||||
}
|
||||
|
||||
count = ois.readInt();
|
||||
LOG.deserializingEntityEntries(count);
|
||||
LOG.trace("Starting deserialization of [" + count + "] entityEntries entries");
|
||||
rtn.entityEntries = IdentityMap.instantiateSequenced( count < INIT_COLL_SIZE ? INIT_COLL_SIZE : count );
|
||||
for ( int i = 0; i < count; i++ ) {
|
||||
Object entity = ois.readObject();
|
||||
|
@ -1581,14 +1576,14 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
}
|
||||
|
||||
count = ois.readInt();
|
||||
LOG.deserializingCollectionsByKey(count);
|
||||
LOG.trace("Starting deserialization of [" + count + "] collectionsByKey entries");
|
||||
rtn.collectionsByKey = new HashMap( count < INIT_COLL_SIZE ? INIT_COLL_SIZE : count );
|
||||
for ( int i = 0; i < count; i++ ) {
|
||||
rtn.collectionsByKey.put( CollectionKey.deserialize( ois, session ), ois.readObject() );
|
||||
}
|
||||
|
||||
count = ois.readInt();
|
||||
LOG.deserializingCollectionEntries(count);
|
||||
LOG.trace("Starting deserialization of [" + count + "] collectionEntries entries");
|
||||
rtn.collectionEntries = IdentityMap.instantiateSequenced( count < INIT_COLL_SIZE ? INIT_COLL_SIZE : count );
|
||||
for ( int i = 0; i < count; i++ ) {
|
||||
final PersistentCollection pc = ( PersistentCollection ) ois.readObject();
|
||||
|
@ -1598,14 +1593,14 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
}
|
||||
|
||||
count = ois.readInt();
|
||||
LOG.deserializingArrayHolders(count);
|
||||
LOG.trace("Starting deserialization of [" + count + "] arrayHolders entries");
|
||||
rtn.arrayHolders = IdentityMap.instantiate( count < INIT_COLL_SIZE ? INIT_COLL_SIZE : count );
|
||||
for ( int i = 0; i < count; i++ ) {
|
||||
rtn.arrayHolders.put( ois.readObject(), ois.readObject() );
|
||||
}
|
||||
|
||||
count = ois.readInt();
|
||||
LOG.deserializingNullifiableEntityKeys(count);
|
||||
LOG.trace("Starting deserialization of [" + count + "] nullifiableEntityKey entries");
|
||||
rtn.nullifiableEntityKeys = new HashSet();
|
||||
for ( int i = 0; i < count; i++ ) {
|
||||
rtn.nullifiableEntityKeys.add( EntityKey.deserialize( ois, session ) );
|
||||
|
@ -1676,107 +1671,4 @@ public class StatefulPersistenceContext implements PersistenceContext {
|
|||
insertedKeysMap.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting deserialization of [%d] arrayHolders entries" )
|
||||
void deserializingArrayHolders( int size );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting deserialization of [%d] collectionEntries entries" )
|
||||
void deserializingCollectionEntries( int size );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting deserialization of [%d] collectionsByKey entries" )
|
||||
void deserializingCollectionsByKey( int size );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting deserialization of [%d] entitiesByKey entries" )
|
||||
void deserializingEntitiesByKey( int size );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting deserialization of [%d] entitiesByUniqueKey entries" )
|
||||
void deserializingEntitiesByUniqueKey( int size );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting deserialization of [%d] entityEntries entries" )
|
||||
void deserializingEntityEntries( int size );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting deserialization of [%d] entitySnapshotsByKey entries" )
|
||||
void deserializingEntitySnapshotsByKey( int size );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting deserialization of [%d] nullifiableEntityKey entries" )
|
||||
void deserializingNullifiableEntityKeys( int size );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Serializing persistent-context" )
|
||||
void deserializingPersistentContext();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting deserialization of [%d] proxiesByKey entries" )
|
||||
void deserializingProxiesByKey( int size );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Encountered prunded proxy" )
|
||||
void encounteredPrunedProxy();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Initializing non-lazy collections" )
|
||||
void initializingNonLazyCollections();
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Narrowing proxy to %s - this operation breaks ==" )
|
||||
void narrowingProxy( Class concreteProxyClass );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting serialization of [%d] arrayHolders entries" )
|
||||
void serializingArrayHolders( int size );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting serialization of [%d] collectionEntries entries" )
|
||||
void serializingCollectionEntries( int size );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting serialization of [%d] collectionsByKey entries" )
|
||||
void serializingCollectionsByKey( int size );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting serialization of [%d] entitiesByKey entries" )
|
||||
void serializingEntitiesByKey( int size );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting serialization of [%d] entitiesByUniqueKey entries" )
|
||||
void serializingEntitiesByUniqueKey( int size );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting serialization of [%d] entityEntries entries" )
|
||||
void serializingEntityEntries( int size );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting serialization of [%d] entitySnapshotsByKey entries" )
|
||||
void serializingEntitySnapshotsByKey( int size );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting serialization of [%d] nullifiableEntityKey entries" )
|
||||
void serializingNullifiableEntityKeys( int size );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Serializing persistent-context" )
|
||||
void serializingPersistentContext();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting serialization of [%d] proxiesByKey entries" )
|
||||
void serializingProxiesByKey( int size );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "setting proxy identifier: %s" )
|
||||
void settingProxyIdentifier( Serializable id );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,13 +23,12 @@
|
|||
*/
|
||||
package org.hibernate.engine;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import java.io.Serializable;
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.CacheMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.cache.CacheKey;
|
||||
import org.hibernate.cache.entry.CacheEntry;
|
||||
import org.hibernate.event.PostLoadEvent;
|
||||
|
@ -43,10 +42,6 @@ import org.hibernate.property.BackrefPropertyAccessor;
|
|||
import org.hibernate.proxy.HibernateProxy;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.TypeHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Functionality relating to Hibernate's two-phase loading process,
|
||||
|
@ -99,7 +94,7 @@ public final class TwoPhaseLoad {
|
|||
String versionStr = persister.isVersioned()
|
||||
? persister.getVersionType().toLoggableString( version, session.getFactory() )
|
||||
: "null";
|
||||
LOG.version(versionStr);
|
||||
LOG.trace("Version: " + versionStr);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -130,7 +125,8 @@ public final class TwoPhaseLoad {
|
|||
Serializable id = entityEntry.getId();
|
||||
Object[] hydratedState = entityEntry.getLoadedState();
|
||||
|
||||
if (LOG.isDebugEnabled()) LOG.resolvingAssociations(MessageHelper.infoString(persister, id, session.getFactory()));
|
||||
if (LOG.isDebugEnabled()) LOG.debug("Resolving associations for "
|
||||
+ MessageHelper.infoString(persister, id, session.getFactory()));
|
||||
|
||||
Type[] types = persister.getPropertyTypes();
|
||||
for ( int i = 0; i < hydratedState.length; i++ ) {
|
||||
|
@ -154,9 +150,8 @@ public final class TwoPhaseLoad {
|
|||
final SessionFactoryImplementor factory = session.getFactory();
|
||||
if ( persister.hasCache() && session.getCacheMode().isPutEnabled() ) {
|
||||
|
||||
if (LOG.isDebugEnabled()) LOG.addingEntityToSecondLevelCache(MessageHelper.infoString(persister,
|
||||
id,
|
||||
session.getFactory()));
|
||||
if (LOG.isDebugEnabled()) LOG.debug("Adding entity to second-level cache: "
|
||||
+ MessageHelper.infoString(persister, id, session.getFactory()));
|
||||
|
||||
Object version = Versioning.getVersion(hydratedState, persister);
|
||||
CacheEntry entry = new CacheEntry(
|
||||
|
@ -249,7 +244,8 @@ public final class TwoPhaseLoad {
|
|||
}
|
||||
}
|
||||
|
||||
if (LOG.isDebugEnabled()) LOG.doneMaterializingEntity(MessageHelper.infoString(persister, id, session.getFactory()));
|
||||
if (LOG.isDebugEnabled()) LOG.debug("Done materializing entity "
|
||||
+ MessageHelper.infoString(persister, id, session.getFactory()));
|
||||
|
||||
if ( factory.getStatistics().isStatisticsEnabled() ) {
|
||||
factory.getStatisticsImplementor().loadEntity( persister.getEntityName() );
|
||||
|
@ -316,27 +312,4 @@ public final class TwoPhaseLoad {
|
|||
lazyPropertiesAreUnfetched
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Adding entity to second-level cache: %s" )
|
||||
void addingEntityToSecondLevelCache( String infoString );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Done materializing entity %s" )
|
||||
void doneMaterializingEntity( String infoString );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Resolving associations for %s" )
|
||||
void resolvingAssociations( String infoString );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Version: %s" )
|
||||
void version( String versionStr );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,13 +24,9 @@
|
|||
*/
|
||||
package org.hibernate.engine;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.id.IdentifierGeneratorHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* A strategy for determining if a version value is an version of
|
||||
|
@ -53,7 +49,7 @@ public class VersionValue {
|
|||
public static final VersionValue NULL = new VersionValue() {
|
||||
@Override
|
||||
public final Boolean isUnsaved(Object version) {
|
||||
LOG.versionUnsavedValueStrategy("NULL");
|
||||
LOG.trace("Version unsaved-value strategy NULL");
|
||||
return version==null ? Boolean.TRUE : Boolean.FALSE;
|
||||
}
|
||||
@Override
|
||||
|
@ -72,7 +68,7 @@ public class VersionValue {
|
|||
public static final VersionValue UNDEFINED = new VersionValue() {
|
||||
@Override
|
||||
public final Boolean isUnsaved(Object version) {
|
||||
LOG.versionUnsavedValueStrategy("UNDEFINED");
|
||||
LOG.trace("Version unsaved-value strategy UNDEFINED");
|
||||
return version==null ? Boolean.TRUE : null;
|
||||
}
|
||||
@Override
|
||||
|
@ -92,7 +88,7 @@ public class VersionValue {
|
|||
|
||||
@Override
|
||||
public final Boolean isUnsaved(Object version) throws MappingException {
|
||||
LOG.versionUnsavedValueStrategy("NEGATIVE");
|
||||
LOG.trace("Version unsaved-value strategy NEGATIVE");
|
||||
if (version==null) return Boolean.TRUE;
|
||||
if (version instanceof Number) return ((Number)version).longValue() < 0l ? Boolean.TRUE : Boolean.FALSE;
|
||||
throw new MappingException("unsaved-value NEGATIVE may only be used with short, int and long types");
|
||||
|
@ -129,7 +125,7 @@ public class VersionValue {
|
|||
* @return true is unsaved, false is saved, null is undefined
|
||||
*/
|
||||
public Boolean isUnsaved(Object version) throws MappingException {
|
||||
LOG.versionUnsavedValue(value);
|
||||
LOG.trace("Version unsaved-value: " + value);
|
||||
return version==null || version.equals(value) ? Boolean.TRUE : Boolean.FALSE;
|
||||
}
|
||||
|
||||
|
@ -141,19 +137,4 @@ public class VersionValue {
|
|||
public String toString() {
|
||||
return "version unsaved-value: " + value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Version unsaved-value: %s" )
|
||||
void versionUnsavedValue( Object value );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Version unsaved-value strategy %s" )
|
||||
void versionUnsavedValueStrategy( String string );
|
||||
}
|
||||
}
|
|
@ -24,13 +24,9 @@
|
|||
*/
|
||||
package org.hibernate.engine;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.type.VersionType;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Utilities for dealing with optimisitic locking values.
|
||||
|
@ -79,7 +75,7 @@ public final class Versioning {
|
|||
*/
|
||||
private static Object seed(VersionType versionType, SessionImplementor session) {
|
||||
Object seed = versionType.seed( session );
|
||||
LOG.seeding(seed);
|
||||
LOG.trace("Seeding: " + seed);
|
||||
return seed;
|
||||
}
|
||||
|
||||
|
@ -112,10 +108,8 @@ public final class Versioning {
|
|||
fields[versionProperty] = seed( versionType, session );
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
LOG.usingInitialVersion(initialVersion);
|
||||
return false;
|
||||
}
|
||||
LOG.trace("Using initial version: " + initialVersion);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@ -130,8 +124,8 @@ public final class Versioning {
|
|||
*/
|
||||
public static Object increment(Object version, VersionType versionType, SessionImplementor session) {
|
||||
Object next = versionType.next( version, session );
|
||||
if (LOG.isTraceEnabled()) LOG.incrementing(versionType.toLoggableString(version, session.getFactory()),
|
||||
versionType.toLoggableString(next, session.getFactory()));
|
||||
if (LOG.isTraceEnabled()) LOG.trace("Incrementing: " + versionType.toLoggableString(version, session.getFactory()) + " to "
|
||||
+ versionType.toLoggableString(next, session.getFactory()));
|
||||
return next;
|
||||
}
|
||||
|
||||
|
@ -185,24 +179,4 @@ public final class Versioning {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Incrementing: %s to %s" )
|
||||
void incrementing( String loggableString,
|
||||
String loggableString2 );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Seeding: %s" )
|
||||
void seeding( Object seed );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Using initial version: %s" )
|
||||
void usingInitialVersion( Object initialVersion );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,11 +30,8 @@ import java.lang.reflect.Method;
|
|||
import java.lang.reflect.Proxy;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.util.JDBCExceptionReporter;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* A proxy for a ResultSet delegate, responsible for locally caching the columnName-to-columnIndex resolution that
|
||||
|
@ -115,7 +112,7 @@ public class ResultSetWrapperProxy implements InvocationHandler {
|
|||
catch ( NoSuchMethodException ex ) {
|
||||
if (LOG.isEnabled(WARN)) {
|
||||
StringBuffer buf = new StringBuffer().append("Exception switching from method: [").append(method).append("] to a method using the column index. Reverting to using: [").append(method).append("]");
|
||||
LOG.missingMethod(buf.toString());
|
||||
LOG.warn(buf.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -189,15 +186,4 @@ public class ResultSetWrapperProxy implements InvocationHandler {
|
|||
throw e.getTargetException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "%s" )
|
||||
void missingMethod( String string );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ public abstract class AbstractBatchImpl implements Batch {
|
|||
}
|
||||
PreparedStatement statement = statements.get( sql );
|
||||
if ( statement != null ) {
|
||||
log.debug( "reusing prepared statement" );
|
||||
LOG.debug("Reusing prepared statement");
|
||||
statementLogger.logStatement( sql );
|
||||
}
|
||||
return statement;
|
||||
|
|
|
@ -53,7 +53,7 @@ public class BatchBuilder {
|
|||
public Batch buildBatch(Object key,
|
||||
SQLStatementLogger statementLogger,
|
||||
SQLExceptionHelper exceptionHelper) {
|
||||
log.trace( "building batch [size={}]", size );
|
||||
LOG.trace("Building batch [size=" + size + "]");
|
||||
return size > 1
|
||||
? new BatchingBatch( key, statementLogger, exceptionHelper, size )
|
||||
: new NonBatchingBatch( key, statementLogger, exceptionHelper );
|
||||
|
|
|
@ -106,15 +106,10 @@ public class BatchingBatch extends AbstractBatchImpl {
|
|||
*/
|
||||
@Override
|
||||
protected void doExecuteBatch() {
|
||||
if ( maxBatchPosition == 0 ) {
|
||||
log.debug( "no batched statements to execute" );
|
||||
}
|
||||
if (maxBatchPosition == 0) LOG.debug("No batched statements to execute");
|
||||
else {
|
||||
if ( log.isDebugEnabled() ) {
|
||||
log.debug( "Executing {} statements with maximum batch size {} ",
|
||||
getStatements().size(), maxBatchPosition
|
||||
);
|
||||
}
|
||||
LOG.debug("Executing " + getStatements().size() + " statements with maximum batch size " + maxBatchPosition);
|
||||
|
||||
try {
|
||||
executeStatements();
|
||||
}
|
||||
|
@ -145,17 +140,10 @@ public class BatchingBatch extends AbstractBatchImpl {
|
|||
);
|
||||
}
|
||||
if ( expectations.size() > 0 ) {
|
||||
if ( log.isDebugEnabled() ) {
|
||||
log.debug( "Executing with batch of size {}: {}", expectations.size(), sql );
|
||||
}
|
||||
LOG.debug("Executing with batch of size " + expectations.size() + ": " + sql);
|
||||
executeStatement( sql, statement, expectations );
|
||||
expectations.clear();
|
||||
}
|
||||
else {
|
||||
if ( log.isDebugEnabled() ) {
|
||||
log.debug( "Skipped executing because batch size is 0: ", sql );
|
||||
}
|
||||
}
|
||||
} else LOG.debug("Skipped executing because batch size is 0: " + sql);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.engine.jdbc.batch.internal;
|
|||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.engine.jdbc.spi.SQLExceptionHelper;
|
||||
import org.hibernate.engine.jdbc.spi.SQLStatementLogger;
|
||||
import org.hibernate.jdbc.Expectation;
|
||||
|
|
|
@ -31,14 +31,11 @@ import java.sql.CallableStatement;
|
|||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Interceptor;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.ScrollMode;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.jdbc.batch.internal.BatchBuilder;
|
||||
|
@ -57,7 +54,7 @@ import org.hibernate.jdbc.Expectation;
|
|||
*/
|
||||
public class ConnectionManagerImpl implements ConnectionManager {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger( ConnectionManagerImpl.class );
|
||||
private static final Logger LOG = org.jboss.logging.Logger.getMessageLogger(Logger.class, Logger.class.getPackage().getName());
|
||||
|
||||
public static interface Callback extends ConnectionObserver {
|
||||
public boolean isTransactionInProgress();
|
||||
|
@ -77,11 +74,11 @@ public class ConnectionManagerImpl implements ConnectionManager {
|
|||
* Constructs a ConnectionManager.
|
||||
* <p/>
|
||||
* This is the form used internally.
|
||||
*
|
||||
*
|
||||
* @param callback An observer for internal state change.
|
||||
* @param releaseMode The mode by which to release JDBC connections.
|
||||
* @param suppliedConnection An externally supplied connection.
|
||||
*/
|
||||
*/
|
||||
public ConnectionManagerImpl(
|
||||
SessionFactoryImplementor factory,
|
||||
Callback callback,
|
||||
|
@ -254,17 +251,11 @@ public class ConnectionManagerImpl implements ConnectionManager {
|
|||
*/
|
||||
public void afterTransaction() {
|
||||
if ( logicalConnection != null ) {
|
||||
if ( isAfterTransactionRelease() || isAggressiveReleaseNoTransactionCheck() ) {
|
||||
logicalConnection.afterTransaction();
|
||||
}
|
||||
else if ( isOnCloseRelease() ) {
|
||||
// log a message about potential connection leaks
|
||||
log.debug( "transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!" );
|
||||
}
|
||||
}
|
||||
if ( statementPreparer != null ) {
|
||||
statementPreparer.unsetTransactionTimeout();
|
||||
if (isAfterTransactionRelease() || isAggressiveReleaseNoTransactionCheck()) logicalConnection.afterTransaction();
|
||||
// log a message about potential connection leaks
|
||||
else if (isOnCloseRelease()) LOG.debug("Transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!");
|
||||
}
|
||||
if (statementPreparer != null) statementPreparer.unsetTransactionTimeout();
|
||||
}
|
||||
|
||||
private boolean isAfterTransactionRelease() {
|
||||
|
@ -349,11 +340,11 @@ public class ConnectionManagerImpl implements ConnectionManager {
|
|||
*/
|
||||
private Connection cleanup() throws HibernateException {
|
||||
if ( logicalConnection == null ) {
|
||||
log.trace( "connection already null in cleanup : no action");
|
||||
LOG.trace("Connection already null in cleanup : no action");
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
log.trace( "performing cleanup" );
|
||||
LOG.trace("Performing cleanup");
|
||||
releaseBatch();
|
||||
statementPreparer.close();
|
||||
Connection c = logicalConnection.close();
|
||||
|
@ -373,7 +364,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
|
|||
*/
|
||||
@Override
|
||||
public void flushBeginning() {
|
||||
log.trace( "registering flush begin" );
|
||||
LOG.trace("Registering flush begin");
|
||||
logicalConnection.disableReleases();
|
||||
}
|
||||
|
||||
|
@ -383,7 +374,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
|
|||
*/
|
||||
@Override
|
||||
public void flushEnding() {
|
||||
log.trace( "registering flush end" );
|
||||
LOG.trace("Registering flush end");
|
||||
logicalConnection.enableReleases();
|
||||
afterStatement();
|
||||
}
|
||||
|
@ -448,7 +439,7 @@ public class ConnectionManagerImpl implements ConnectionManager {
|
|||
@Override
|
||||
public CallableStatement prepareCallableStatement(String sql) {
|
||||
executeBatch();
|
||||
log.trace("preparing callable statement");
|
||||
LOG.trace("Preparing callable statement");
|
||||
return CallableStatement.class.cast( statementPreparer.prepareStatement( getSQL( sql ), true ) );
|
||||
}
|
||||
|
||||
|
|
|
@ -24,9 +24,6 @@
|
|||
*/
|
||||
package org.hibernate.engine.jdbc.internal;
|
||||
|
||||
import java.io.ObjectOutputStream;
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
|
@ -37,6 +34,7 @@ import javax.transaction.TransactionManager;
|
|||
import org.hibernate.ConnectionReleaseMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Interceptor;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.SessionException;
|
||||
import org.hibernate.Transaction;
|
||||
import org.hibernate.TransactionException;
|
||||
|
@ -45,17 +43,6 @@ import org.hibernate.engine.jdbc.spi.JDBCContext;
|
|||
import org.hibernate.transaction.synchronization.CallbackCoordinator;
|
||||
import org.hibernate.transaction.synchronization.HibernateSynchronizationImpl;
|
||||
import org.hibernate.util.JTAHelper;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.exception.JDBCExceptionHelper;
|
||||
import org.hibernate.transaction.TransactionFactory;
|
||||
import org.hibernate.transaction.synchronization.CallbackCoordinator;
|
||||
import org.hibernate.transaction.synchronization.HibernateSynchronizationImpl;
|
||||
import org.hibernate.util.JTAHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Acts as the intermediary between "entity-mode related" sessions in terms of their interaction with the JDBC data store.
|
||||
|
@ -199,13 +186,13 @@ public class JDBCContextImpl implements ConnectionManagerImpl.Callback, JDBCCont
|
|||
if (tm == null) return false;
|
||||
try {
|
||||
if (!isTransactionInProgress()) {
|
||||
LOG.noActiveTransaction();
|
||||
LOG.trace("TransactionFactory reported no active transaction; Synchronization not registered");
|
||||
return false;
|
||||
}
|
||||
javax.transaction.Transaction tx = tm.getTransaction();
|
||||
if (JTAHelper.isMarkedForRollback(tx)) {
|
||||
// transactions marked for rollback-only cause some TM impls to throw exceptions
|
||||
LOG.transactionMarkedForRollback();
|
||||
LOG.debug("Transaction is marked for rollback; skipping Synchronization registration");
|
||||
return false;
|
||||
}
|
||||
if (hibernateTransaction == null) hibernateTransaction = owner.getFactory().getSettings().getTransactionFactory().createTransaction(this,
|
||||
|
@ -213,7 +200,7 @@ public class JDBCContextImpl implements ConnectionManagerImpl.Callback, JDBCCont
|
|||
tx.registerSynchronization(new HibernateSynchronizationImpl(getJtaSynchronizationCallbackCoordinator(tx)));
|
||||
// tx.registerSynchronization( new CacheSynchronization(owner, this, tx, hibernateTransaction) );
|
||||
isTransactionCallbackRegistered = true;
|
||||
LOG.successfullyRegisteredSynchronization();
|
||||
LOG.debug("Successfully registered Synchronization");
|
||||
return true;
|
||||
} catch (HibernateException e) {
|
||||
throw e;
|
||||
|
@ -221,7 +208,7 @@ public class JDBCContextImpl implements ConnectionManagerImpl.Callback, JDBCCont
|
|||
throw new TransactionException("could not register synchronization with JTA TransactionManager", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isTransactionInProgress() {
|
||||
return owner.getFactory().getSettings().getTransactionFactory()
|
||||
|
@ -237,10 +224,10 @@ public class JDBCContextImpl implements ConnectionManagerImpl.Callback, JDBCCont
|
|||
}
|
||||
return hibernateTransaction;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void beforeTransactionCompletion(Transaction tx) {
|
||||
LOG.beforeTransactionCompletion();
|
||||
LOG.trace("Before transaction completion");
|
||||
owner.beforeTransactionCompletion(tx);
|
||||
}
|
||||
|
||||
|
@ -250,13 +237,13 @@ public class JDBCContextImpl implements ConnectionManagerImpl.Callback, JDBCCont
|
|||
*/
|
||||
@Override
|
||||
public void afterTransactionBegin(Transaction tx) {
|
||||
LOG.afterTransactionBegin();
|
||||
LOG.trace("After transaction begin");
|
||||
owner.afterTransactionBegin(tx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTransactionCompletion(boolean success, Transaction tx) {
|
||||
LOG.afterTransactionCompletion();
|
||||
LOG.trace("After transaction completion");
|
||||
|
||||
if ( getFactory().getStatistics().isStatisticsEnabled() ) {
|
||||
getFactory().getStatisticsImplementor().endTransaction(success);
|
||||
|
@ -275,7 +262,7 @@ public class JDBCContextImpl implements ConnectionManagerImpl.Callback, JDBCCont
|
|||
*/
|
||||
@Override
|
||||
public void afterNontransactionalQuery(boolean success) {
|
||||
LOG.afterAutoCommit();
|
||||
LOG.trace("After autocommit");
|
||||
try {
|
||||
// check to see if the connection is in auto-commit
|
||||
// mode (no connection means aggressive connection
|
||||
|
@ -358,39 +345,4 @@ public class JDBCContextImpl implements ConnectionManagerImpl.Callback, JDBCCont
|
|||
);
|
||||
return jdbcContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "After autocommit" )
|
||||
void afterAutoCommit();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "After transaction begin" )
|
||||
void afterTransactionBegin();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "After transaction completion" )
|
||||
void afterTransactionCompletion();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Before transaction completion" )
|
||||
void beforeTransactionCompletion();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "TransactionFactory reported no active transaction; Synchronization not registered" )
|
||||
void noActiveTransaction();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Successfully registered Synchronization" )
|
||||
void successfullyRegisteredSynchronization();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Transaction is marked for rollback; skipping Synchronization registration" )
|
||||
void transactionMarkedForRollback();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.engine.jdbc.internal;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
@ -38,11 +35,7 @@ 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.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Logger.Level;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Standard implementation of the {@link org.hibernate.engine.jdbc.spi.JdbcResourceRegistry} contract
|
||||
|
@ -65,7 +58,7 @@ public class JdbcResourceRegistryImpl implements JdbcResourceRegistry {
|
|||
}
|
||||
|
||||
public void register(Statement statement) {
|
||||
LOG.registeringStatement(statement);
|
||||
LOG.trace("Registering statement [" + statement + "]");
|
||||
if ( xref.containsKey( statement ) ) {
|
||||
throw new HibernateException( "statement already registered with JDBCContainer" );
|
||||
}
|
||||
|
@ -74,7 +67,7 @@ public class JdbcResourceRegistryImpl implements JdbcResourceRegistry {
|
|||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
public void registerLastQuery(Statement statement) {
|
||||
log.trace( "registering last query statement [{}]", statement );
|
||||
LOG.trace("Registering last query statement [" + statement + "]");
|
||||
if ( statement instanceof JdbcWrapper ) {
|
||||
JdbcWrapper<Statement> wrapper = ( JdbcWrapper<Statement> ) statement;
|
||||
registerLastQuery( wrapper.getWrappedObject() );
|
||||
|
@ -101,7 +94,7 @@ public class JdbcResourceRegistryImpl implements JdbcResourceRegistry {
|
|||
}
|
||||
|
||||
public void release(Statement statement) {
|
||||
LOG.releasingStatement(statement);
|
||||
LOG.trace("Releasing statement [" + statement + "]");
|
||||
Set<ResultSet> resultSets = xref.get( statement );
|
||||
if ( resultSets != null ) {
|
||||
for ( ResultSet resultSet : resultSets ) {
|
||||
|
@ -114,7 +107,7 @@ public class JdbcResourceRegistryImpl implements JdbcResourceRegistry {
|
|||
}
|
||||
|
||||
public void register(ResultSet resultSet) {
|
||||
LOG.registeringResultSet(resultSet);
|
||||
LOG.trace("Registering result set [" + resultSet + "]");
|
||||
Statement statement;
|
||||
try {
|
||||
statement = resultSet.getStatement();
|
||||
|
@ -137,7 +130,7 @@ public class JdbcResourceRegistryImpl implements JdbcResourceRegistry {
|
|||
}
|
||||
|
||||
public void release(ResultSet resultSet) {
|
||||
LOG.releasingResultSet(resultSet);
|
||||
LOG.trace("Releasing result set [" + resultSet + "]");
|
||||
Statement statement;
|
||||
try {
|
||||
statement = resultSet.getStatement();
|
||||
|
@ -167,7 +160,7 @@ public class JdbcResourceRegistryImpl implements JdbcResourceRegistry {
|
|||
}
|
||||
|
||||
public void releaseResources() {
|
||||
LOG.releasingJdbcContainerResources(this);
|
||||
LOG.trace("Releasing JDBC container resources [" + this + "]");
|
||||
cleanup();
|
||||
}
|
||||
|
||||
|
@ -243,13 +236,13 @@ public class JdbcResourceRegistryImpl implements JdbcResourceRegistry {
|
|||
}
|
||||
|
||||
public void close() {
|
||||
LOG.closingJdbcContainer(this);
|
||||
LOG.trace("Closing JDBC container [" + this + "]");
|
||||
cleanup();
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
protected void close(Statement statement) {
|
||||
LOG.closingPreparedStatement(statement);
|
||||
LOG.trace("Closing prepared statement [" + statement + "]");
|
||||
|
||||
if ( statement instanceof InvalidatableWrapper ) {
|
||||
InvalidatableWrapper<Statement> wrapper = ( InvalidatableWrapper<Statement> ) statement;
|
||||
|
@ -271,7 +264,7 @@ public class JdbcResourceRegistryImpl implements JdbcResourceRegistry {
|
|||
}
|
||||
catch( SQLException sqle ) {
|
||||
// there was a problem "cleaning" the prepared statement
|
||||
LOG.unableToClearMaxRowsQueryTimeout(sqle.getMessage());
|
||||
LOG.debug("Exception clearing maxRows/queryTimeout [" + sqle.getMessage() + "]");
|
||||
return; // EARLY EXIT!!!
|
||||
}
|
||||
statement.close();
|
||||
|
@ -280,13 +273,13 @@ public class JdbcResourceRegistryImpl implements JdbcResourceRegistry {
|
|||
}
|
||||
}
|
||||
catch( SQLException sqle ) {
|
||||
LOG.unableToReleaseStatement(sqle.getMessage());
|
||||
LOG.debug("Unable to release statement [" + sqle.getMessage() + "]");
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
protected void close(ResultSet resultSet) {
|
||||
LOG.closingResultSet(resultSet);
|
||||
LOG.trace("Closing result set [" + resultSet + "]");
|
||||
|
||||
if ( resultSet instanceof InvalidatableWrapper ) {
|
||||
InvalidatableWrapper<ResultSet> wrapper = (InvalidatableWrapper<ResultSet>) resultSet;
|
||||
|
@ -298,66 +291,7 @@ public class JdbcResourceRegistryImpl implements JdbcResourceRegistry {
|
|||
resultSet.close();
|
||||
}
|
||||
catch( SQLException e ) {
|
||||
LOG.unableToReleaseResultSet(e.getMessage());
|
||||
LOG.debug("Unable to release result set [" + e.getMessage() + "]");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Closing JDBC container [%s]" )
|
||||
void closingJdbcContainer( JdbcResourceRegistryImpl jdbcResourceRegistryImpl );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Closing prepared statement [%s]" )
|
||||
void closingPreparedStatement( Statement statement );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Closing result set [%s]" )
|
||||
void closingResultSet( ResultSet resultSet );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Registering result set [%s]" )
|
||||
void registeringResultSet( ResultSet resultSet );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Registering statement [%s]" )
|
||||
void registeringStatement( Statement statement );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Releasing JDBC container resources [%s]" )
|
||||
void releasingJdbcContainerResources( JdbcResourceRegistryImpl jdbcResourceRegistryImpl );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Releasing result set [%s]" )
|
||||
void releasingResultSet( ResultSet resultSet );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Releasing statement [%s]" )
|
||||
void releasingStatement( Statement statement );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Exception clearing maxRows/queryTimeout [%s]" )
|
||||
void unableToClearMaxRowsQueryTimeout( String message );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Unable to release result set [%s]" )
|
||||
void unableToReleaseResultSet( String message );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Unable to release statement [%s]" )
|
||||
void unableToReleaseStatement( String message );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "ResultSet's statement was not registered" )
|
||||
void unregisteredStatement();
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "ResultSet had no statement associated with it, but was not yet registered" )
|
||||
void unregisteredResultSetWithoutStatement();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.engine.jdbc.internal;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
|
@ -34,6 +32,7 @@ import java.util.HashSet;
|
|||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.engine.jdbc.spi.ExtractedDatabaseMetaData;
|
||||
|
@ -49,10 +48,6 @@ import org.hibernate.service.jdbc.dialect.spi.DialectFactory;
|
|||
import org.hibernate.service.spi.Configurable;
|
||||
import org.hibernate.service.spi.InjectService;
|
||||
import org.hibernate.util.ReflectHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Standard implementation of the {@link JdbcServices} contract
|
||||
|
@ -336,60 +331,4 @@ public class JdbcServicesImpl implements JdbcServices, Configurable {
|
|||
public ExtractedDatabaseMetaData getExtractedMetaDataSupport() {
|
||||
return extractedMetaDataSupport;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
// @formatter:off
|
||||
@Message( value = "Database ->\n" +
|
||||
" name : %s\n" +
|
||||
" version : %s\n" +
|
||||
" major : %s\n" +
|
||||
" minor : %s" )
|
||||
// @formatter:on
|
||||
void database( String databaseProductName,
|
||||
String databaseProductVersion,
|
||||
int databaseMajorVersion,
|
||||
int databaseMinorVersion );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
// @formatter:off
|
||||
@Message( value = "Driver ->\n" +
|
||||
" name : %s\n" +
|
||||
" version : %s\n" +
|
||||
" major : %s\n" +
|
||||
" minor : %s" )
|
||||
// @formatter:on
|
||||
void driver( String driverProductName,
|
||||
String driverProductVersion,
|
||||
int driverMajorVersion,
|
||||
int driverMinorVersion );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "JDBC version : %d.%d" )
|
||||
void jdbcVersion( int jdbcMajorVersion,
|
||||
int jdbcMinorVersion );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Unable to instantiate configured schema name resolver [%s] %s" )
|
||||
void unableToInstantiateConfiguredSchemaNameResolver( String resolverClassName,
|
||||
String message );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Unable to locate configured schema name resolver class [%s] %s" )
|
||||
void unableToLocateConfiguredSchemaNameResolver( String resolverClassName,
|
||||
String message );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Could not obtain connection metadata : %s" )
|
||||
void unableToObtainConnectionMetadata( String message );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Could not obtain connection to query metadata : %s" )
|
||||
void unableToObtainConnectionToQueryMetadata( String message );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ public class LogicalConnectionImpl implements LogicalConnectionImplementor {
|
|||
}
|
||||
else if ( connectionReleaseMode == ConnectionReleaseMode.AFTER_STATEMENT &&
|
||||
! jdbcServices.getConnectionProvider().supportsAggressiveRelease() ) {
|
||||
log.debug( "connection provider reports to not support aggressive release; overriding" );
|
||||
LOG.debug("Connection provider reports to not support aggressive release; overriding");
|
||||
return ConnectionReleaseMode.AFTER_TRANSACTION;
|
||||
}
|
||||
else {
|
||||
|
@ -187,7 +187,7 @@ public class LogicalConnectionImpl implements LogicalConnectionImplementor {
|
|||
Connection c = physicalConnection;
|
||||
try {
|
||||
releaseBorrowedConnection();
|
||||
log.trace( "closing logical connection" );
|
||||
LOG.trace("Closing logical connection");
|
||||
if ( !isUserSuppliedConnection && physicalConnection != null ) {
|
||||
jdbcResourceRegistry.close();
|
||||
releaseConnection();
|
||||
|
@ -198,7 +198,7 @@ public class LogicalConnectionImpl implements LogicalConnectionImplementor {
|
|||
// no matter what
|
||||
physicalConnection = null;
|
||||
isClosed = true;
|
||||
LOG.closedLogicalConnection();
|
||||
LOG.trace("Logical connection closed");
|
||||
for ( ConnectionObserver observer : observers ) {
|
||||
observer.logicalConnectionClosed();
|
||||
}
|
||||
|
@ -243,19 +243,16 @@ public class LogicalConnectionImpl implements LogicalConnectionImplementor {
|
|||
}
|
||||
|
||||
public void afterStatementExecution() {
|
||||
LOG.startingAfterStatementExecution(connectionReleaseMode);
|
||||
LOG.trace("Starting after statement execution processing [" + connectionReleaseMode + "]");
|
||||
if ( connectionReleaseMode == ConnectionReleaseMode.AFTER_STATEMENT ) {
|
||||
if ( ! releasesEnabled ) {
|
||||
LOG.skippingAggressiveReleaseDueToManualDisabling();
|
||||
LOG.debug("Skipping aggressive release due to manual disabling");
|
||||
return;
|
||||
}
|
||||
if ( jdbcResourceRegistry.hasRegisteredResources() ) {
|
||||
LOG.skippingAggressiveReleaseDueToRegisteredResources();
|
||||
LOG.debug("Skipping aggressive release due to registered resources");
|
||||
return;
|
||||
}
|
||||
else if ( borrowedConnection != null ) {
|
||||
log.debug( "skipping aggresive-release due to borrowed connection" );
|
||||
}
|
||||
} else if (borrowedConnection != null) LOG.debug("Skipping aggressive release due to borrowed connection");
|
||||
releaseConnection();
|
||||
}
|
||||
}
|
||||
|
@ -272,12 +269,12 @@ public class LogicalConnectionImpl implements LogicalConnectionImplementor {
|
|||
}
|
||||
|
||||
public void disableReleases() {
|
||||
LOG.disablingReleases();
|
||||
LOG.trace("Disabling releases");
|
||||
releasesEnabled = false;
|
||||
}
|
||||
|
||||
public void enableReleases() {
|
||||
LOG.enablingReleases();
|
||||
LOG.trace("(Re)enabling releases");
|
||||
releasesEnabled = true;
|
||||
//FIXME: uncomment after new batch stuff is integrated!!!
|
||||
//afterStatementExecution();
|
||||
|
@ -287,11 +284,9 @@ public class LogicalConnectionImpl implements LogicalConnectionImplementor {
|
|||
* Force aggresive release of the underlying connection.
|
||||
*/
|
||||
public void aggressiveRelease() {
|
||||
if ( isUserSuppliedConnection ) {
|
||||
LOG.unableToAggressivelyReleaseUserSuppliedConnection();
|
||||
}
|
||||
if (isUserSuppliedConnection) LOG.debug("Cannot aggressively release user-supplied connection; skipping");
|
||||
else {
|
||||
LOG.aggressivelyReleasingJdbcConnection( );
|
||||
LOG.debug("Aggressively releasing JDBC connection");
|
||||
if ( physicalConnection != null ) {
|
||||
releaseConnection();
|
||||
}
|
||||
|
@ -305,13 +300,13 @@ public class LogicalConnectionImpl implements LogicalConnectionImplementor {
|
|||
* @throws org.hibernate.JDBCException Indicates problem opening a connection
|
||||
*/
|
||||
private void obtainConnection() throws JDBCException {
|
||||
LOG.obtainingJdbcConnection();
|
||||
LOG.debug("Obtaining JDBC connection");
|
||||
try {
|
||||
physicalConnection = getJdbcServices().getConnectionProvider().getConnection();
|
||||
for ( ConnectionObserver observer : observers ) {
|
||||
observer.physicalConnectionObtained( physicalConnection );
|
||||
}
|
||||
LOG.obtainedJdbcConnection();
|
||||
LOG.debug("Obtained JDBC connection");
|
||||
}
|
||||
catch ( SQLException sqle) {
|
||||
throw getJdbcServices().getSqlExceptionHelper().convert( sqle, "Could not open connection" );
|
||||
|
@ -324,18 +319,11 @@ public class LogicalConnectionImpl implements LogicalConnectionImplementor {
|
|||
* @throws JDBCException Indicates problem closing a connection
|
||||
*/
|
||||
private void releaseConnection() throws JDBCException {
|
||||
LOG.releasingJdbcConnection();
|
||||
if ( physicalConnection == null ) {
|
||||
return;
|
||||
}
|
||||
LOG.debug("Releasing JDBC connection");
|
||||
if ( physicalConnection == null ) return;
|
||||
try {
|
||||
if ( ! physicalConnection.isClosed() ) {
|
||||
getJdbcServices().getSqlExceptionHelper().logAndClearWarnings( physicalConnection );
|
||||
}
|
||||
if ( !isUserSuppliedConnection ) {
|
||||
getJdbcServices().getConnectionProvider().closeConnection( physicalConnection );
|
||||
}
|
||||
LOG.releasedJdbcConnection();
|
||||
if (!physicalConnection.isClosed()) getJdbcServices().getSqlExceptionHelper().logAndClearWarnings(physicalConnection);
|
||||
if (!isUserSuppliedConnection) getJdbcServices().getConnectionProvider().closeConnection(physicalConnection);
|
||||
}
|
||||
catch (SQLException sqle) {
|
||||
throw getJdbcServices().getSqlExceptionHelper().convert( sqle, "Could not close connection" );
|
||||
|
@ -343,7 +331,7 @@ public class LogicalConnectionImpl implements LogicalConnectionImplementor {
|
|||
finally {
|
||||
physicalConnection = null;
|
||||
}
|
||||
log.debug( "released JDBC connection" );
|
||||
LOG.debug("Released JDBC connection");
|
||||
for ( ConnectionObserver observer : observers ) {
|
||||
observer.physicalConnectionReleased();
|
||||
}
|
||||
|
@ -389,13 +377,11 @@ public class LogicalConnectionImpl implements LogicalConnectionImplementor {
|
|||
);
|
||||
}
|
||||
physicalConnection = suppliedConnection;
|
||||
log.debug( "reconnected JDBC connection" );
|
||||
LOG.debug("Reconnected JDBC connection");
|
||||
}
|
||||
else {
|
||||
if ( suppliedConnection != null ) {
|
||||
throw new IllegalStateException( "unexpected user-supplied connection" );
|
||||
}
|
||||
log.debug( "called reconnect() with null connection (not user-supplied)" );
|
||||
if (suppliedConnection != null) throw new IllegalStateException("unexpected user-supplied connection");
|
||||
LOG.debug("Called reconnect() with null connection (not user-supplied)");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -424,73 +410,4 @@ public class LogicalConnectionImpl implements LogicalConnectionImplementor {
|
|||
ois.readBoolean()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
/*
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Aggressively releasing JDBC connection" )
|
||||
void aggressivelyReleasingJdbcConnection();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Logical connection closed" )
|
||||
void closedLogicalConnection();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Closing logical connection" )
|
||||
void closingLogicalConnection();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Disabling releases" )
|
||||
void disablingReleases();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "(Re)enabling releases" )
|
||||
void enablingReleases();
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Forcing container resource cleanup on transaction completion" )
|
||||
void forcingContainerResourceCleanup();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Obtained JDBC connection" )
|
||||
void obtainedJdbcConnection();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Obtaining JDBC connection" )
|
||||
void obtainingJdbcConnection();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Released JDBC connection" )
|
||||
void releasedJdbcConnection();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Releasing JDBC connection" )
|
||||
void releasingJdbcConnection();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Skipping aggressive release due to manual disabling" )
|
||||
void skippingAggressiveReleaseDueToManualDisabling();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Skipping aggressive release due to registered resources" )
|
||||
void skippingAggressiveReleaseDueToRegisteredResources();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting after statement execution processing [%s]" )
|
||||
void startingAfterStatementExecution( ConnectionReleaseMode connectionReleaseMode );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Cannot aggressively release user-supplied connection; skipping" )
|
||||
void unableToAggressivelyReleaseUserSuppliedConnection();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Connection provider reports to not support aggressive release; overriding" )
|
||||
void unsupportedAggressiveRelease();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -28,12 +28,9 @@ import java.sql.PreparedStatement;
|
|||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.hibernate.AssertionFailure;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.ScrollMode;
|
||||
import org.hibernate.TransactionException;
|
||||
import org.hibernate.cfg.Settings;
|
||||
|
@ -48,7 +45,7 @@ import org.hibernate.engine.jdbc.spi.SQLExceptionHelper;
|
|||
*/
|
||||
public class StatementPreparer {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger( StatementPreparer.class );
|
||||
private static final Logger LOG = org.jboss.logging.Logger.getMessageLogger(Logger.class, Logger.class.getPackage().getName());
|
||||
|
||||
// TODO: Move JDBC settings into a different object...
|
||||
private final Settings settings;
|
||||
|
@ -88,7 +85,7 @@ public class StatementPreparer {
|
|||
return ps;
|
||||
}
|
||||
catch ( SQLException sqle ) {
|
||||
log.error( "sqlexception escaped proxy", sqle );
|
||||
LOG.error(LOG.sqlExceptionEscapedProxy(), sqle);
|
||||
throw sqlExceptionHelper.convert(
|
||||
sqle, "could not prepare statement", sql
|
||||
);
|
||||
|
@ -100,7 +97,8 @@ public class StatementPreparer {
|
|||
QueryStatementPreparation(String sql) {
|
||||
super( sql );
|
||||
}
|
||||
public void postProcess(PreparedStatement preparedStatement) throws SQLException {
|
||||
@Override
|
||||
public void postProcess(PreparedStatement preparedStatement) throws SQLException {
|
||||
super.postProcess( preparedStatement );
|
||||
setStatementFetchSize( preparedStatement );
|
||||
}
|
||||
|
@ -111,7 +109,7 @@ public class StatementPreparer {
|
|||
proxiedConnection.close();
|
||||
}
|
||||
catch (SQLException sqle) {
|
||||
log.error( "sqlexception escaped proxy", sqle );
|
||||
LOG.error(LOG.sqlExceptionEscapedProxy(), sqle);
|
||||
throw sqlExceptionHelper.convert( sqle, "could not close connection proxy" );
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +126,8 @@ public class StatementPreparer {
|
|||
*/
|
||||
public PreparedStatement prepareStatement(String sql, final boolean isCallable) {
|
||||
StatementPreparation statementPreparation = new StatementPreparation( sql ) {
|
||||
public PreparedStatement doPrepare() throws SQLException {
|
||||
@Override
|
||||
public PreparedStatement doPrepare() throws SQLException {
|
||||
return isCallable ?
|
||||
proxiedConnection.prepareCall( getSql() ) :
|
||||
proxiedConnection.prepareStatement( getSql() );
|
||||
|
@ -154,11 +153,12 @@ public class StatementPreparer {
|
|||
*/
|
||||
public PreparedStatement prepareStatement(String sql, final int autoGeneratedKeys)
|
||||
throws HibernateException {
|
||||
if ( autoGeneratedKeys == PreparedStatement.RETURN_GENERATED_KEYS ) {
|
||||
if ( autoGeneratedKeys == Statement.RETURN_GENERATED_KEYS ) {
|
||||
checkAutoGeneratedKeysSupportEnabled();
|
||||
}
|
||||
StatementPreparation statementPreparation = new StatementPreparation( sql ) {
|
||||
public PreparedStatement doPrepare() throws SQLException {
|
||||
@Override
|
||||
public PreparedStatement doPrepare() throws SQLException {
|
||||
return proxiedConnection.prepareStatement( getSql(), autoGeneratedKeys );
|
||||
}
|
||||
};
|
||||
|
@ -176,7 +176,8 @@ public class StatementPreparer {
|
|||
public PreparedStatement prepareStatement(String sql, final String[] columnNames) {
|
||||
checkAutoGeneratedKeysSupportEnabled();
|
||||
StatementPreparation preparation = new StatementPreparation( sql ) {
|
||||
public PreparedStatement doPrepare() throws SQLException {
|
||||
@Override
|
||||
public PreparedStatement doPrepare() throws SQLException {
|
||||
return proxiedConnection.prepareStatement( getSql(), columnNames );
|
||||
}
|
||||
};
|
||||
|
@ -201,7 +202,8 @@ public class StatementPreparer {
|
|||
final boolean isCallable
|
||||
) {
|
||||
StatementPreparation prep = new QueryStatementPreparation( sql ) {
|
||||
public PreparedStatement doPrepare() throws SQLException {
|
||||
@Override
|
||||
public PreparedStatement doPrepare() throws SQLException {
|
||||
return isCallable ?
|
||||
proxiedConnection.prepareCall( getSql() ) :
|
||||
proxiedConnection.prepareStatement( getSql() );
|
||||
|
@ -226,7 +228,8 @@ public class StatementPreparer {
|
|||
throw new AssertionFailure("scrollable result sets are not enabled");
|
||||
}
|
||||
StatementPreparation prep = new QueryStatementPreparation( sql ) {
|
||||
public PreparedStatement doPrepare() throws SQLException {
|
||||
@Override
|
||||
public PreparedStatement doPrepare() throws SQLException {
|
||||
return isCallable ?
|
||||
proxiedConnection.prepareCall(
|
||||
getSql(), scrollMode.toResultSetType(), ResultSet.CONCUR_READ_ONLY
|
||||
|
|
|
@ -23,18 +23,14 @@
|
|||
*/
|
||||
package org.hibernate.engine.jdbc.internal.proxy;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.engine.jdbc.spi.JdbcResourceRegistry;
|
||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Basic support for building {@link ResultSet}-based proxy handlers
|
||||
|
@ -71,7 +67,7 @@ public abstract class AbstractResultSetProxyHandler extends AbstractProxyHandler
|
|||
@Override
|
||||
protected Object continueInvocation(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
String methodName = method.getName();
|
||||
LOG.handlingInvocationOfResultSetMethod(methodName);
|
||||
LOG.trace("Handling invocation of ResultSet method [" + methodName + "]");
|
||||
|
||||
// other methods allowed while invalid ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
if ( "close".equals( methodName ) ) {
|
||||
|
@ -107,13 +103,9 @@ public abstract class AbstractResultSetProxyHandler extends AbstractProxyHandler
|
|||
}
|
||||
catch ( InvocationTargetException e ) {
|
||||
Throwable realException = e.getTargetException();
|
||||
if ( SQLException.class.isInstance( realException ) ) {
|
||||
throw getJdbcServices().getSqlExceptionHelper()
|
||||
.convert( ( SQLException ) realException, realException.getMessage() );
|
||||
}
|
||||
else {
|
||||
throw realException;
|
||||
}
|
||||
if (SQLException.class.isInstance(realException)) throw getJdbcServices().getSqlExceptionHelper().convert((SQLException)realException,
|
||||
realException.getMessage());
|
||||
throw realException;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,15 +119,4 @@ public abstract class AbstractResultSetProxyHandler extends AbstractProxyHandler
|
|||
resultSet = null;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Handling invocation of ResultSet method [%s]" )
|
||||
void handlingInvocationOfResultSetMethod( String methodName );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,20 +23,16 @@
|
|||
*/
|
||||
package org.hibernate.engine.jdbc.internal.proxy;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import org.hibernate.Logger;
|
||||
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.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Basic support for building {@link Statement}-based proxy handlers
|
||||
|
@ -87,7 +83,7 @@ public abstract class AbstractStatementProxyHandler extends AbstractProxyHandler
|
|||
@Override
|
||||
protected Object continueInvocation(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
String methodName = method.getName();
|
||||
LOG.handlingInvocationOfStatementMethod(methodName);
|
||||
LOG.trace("Handling invocation of statement method [" + methodName + "]");
|
||||
|
||||
// other methods allowed while invalid ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
if ( "close".equals( methodName ) ) {
|
||||
|
@ -169,15 +165,4 @@ public abstract class AbstractStatementProxyHandler extends AbstractProxyHandler
|
|||
statement = null;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Handling invocation of statement method [%s]" )
|
||||
void handlingInvocationOfStatementMethod( String methodName );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ public class ConnectionProxyHandler extends AbstractProxyHandler implements Invo
|
|||
@Override
|
||||
protected Object continueInvocation(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
String methodName = method.getName();
|
||||
LOG.handlingInvocationOfConnectionMethod(methodName);
|
||||
LOG.trace("Handling invocation of connection method [" + methodName + "]");
|
||||
|
||||
// other methods allowed while invalid ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
if ( "close".equals( methodName ) ) {
|
||||
|
@ -196,7 +196,7 @@ public class ConnectionProxyHandler extends AbstractProxyHandler implements Invo
|
|||
}
|
||||
|
||||
private void invalidateHandle() {
|
||||
LOG.invalidatingConnectionHandle();
|
||||
LOG.trace("Invalidating connection handle");
|
||||
logicalConnection = null;
|
||||
invalidate();
|
||||
}
|
||||
|
@ -222,33 +222,7 @@ public class ConnectionProxyHandler extends AbstractProxyHandler implements Invo
|
|||
invalidateHandle();
|
||||
}
|
||||
|
||||
/* package-protected */
|
||||
StatisticsImplementor getStatisticsImplementorOrNull() {
|
||||
return getLogicalConnection().getStatisticsImplementor();
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
/*
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Handling invocation of connection method [%s]" )
|
||||
void handlingInvocationOfConnectionMethod( String methodName );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Invalidating connection handle" )
|
||||
void invalidatingConnectionHandle();
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "*** Logical connection closed ***" )
|
||||
void logicalConnectionClosed();
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Logical connection releasing its physical connection" )
|
||||
void logicalConnectionReleasingPhysicalConnection();
|
||||
StatisticsImplementor getStatisticsImplementorOrNull() {
|
||||
return getLogicalConnection().getStatisticsImplementor();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -23,14 +23,12 @@
|
|||
*/
|
||||
package org.hibernate.engine.jdbc.internal.proxy;
|
||||
|
||||
import static org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.LOG;
|
||||
import java.lang.reflect.Method;
|
||||
import java.sql.Connection;
|
||||
import java.sql.Statement;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Invocation handler for {@link java.sql.PreparedStatement} proxies
|
||||
*
|
||||
|
@ -51,7 +49,8 @@ public class PreparedStatementProxyHandler extends AbstractStatementProxyHandler
|
|||
this.sql = sql;
|
||||
}
|
||||
|
||||
protected void beginningInvocationHandling(Method method, Object[] args) {
|
||||
@Override
|
||||
protected void beginningInvocationHandling(Method method, Object[] args) {
|
||||
if ( isExecution( method ) ) {
|
||||
logExecution();
|
||||
}
|
||||
|
@ -69,13 +68,13 @@ public class PreparedStatementProxyHandler extends AbstractStatementProxyHandler
|
|||
}
|
||||
|
||||
private void journalParameterBind(Method method, Object[] args) {
|
||||
log.trace( "binding via {}: []", method.getName(), Arrays.asList( args ) );
|
||||
LOG.trace("Binding via " + method.getName() + ": " + Arrays.asList(args));
|
||||
}
|
||||
|
||||
private boolean isExecution(Method method) {
|
||||
return false;
|
||||
}
|
||||
|
||||
private void logExecution() {
|
||||
}
|
||||
private void logExecution() {
|
||||
}
|
||||
}
|
|
@ -23,22 +23,17 @@
|
|||
*/
|
||||
package org.hibernate.engine.jdbc.spi;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.ERROR;
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.SQLWarning;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.exception.SQLExceptionConverter;
|
||||
import org.hibernate.exception.SQLStateConverter;
|
||||
import org.hibernate.exception.ViolatedConstraintNameExtracter;
|
||||
import org.hibernate.util.StringHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Helper for handling SQLExceptions in various manners.
|
||||
|
@ -143,7 +138,7 @@ public class SQLExceptionHelper {
|
|||
connection.clearWarnings();
|
||||
}
|
||||
catch ( SQLException sqle ) {
|
||||
LOG.unableToClearWarnings(sqle);
|
||||
LOG.debug("Could not clear warnings : " + sqle);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -165,15 +160,15 @@ public class SQLExceptionHelper {
|
|||
*/
|
||||
public void logWarnings(SQLWarning warning, String message) {
|
||||
if (LOG.isEnabled(WARN)) {
|
||||
if (warning != null) LOG.warningPreamble(StringHelper.isNotEmpty(message) ? message : DEFAULT_WARNING_MSG, warning);
|
||||
if (warning != null) LOG.debug((StringHelper.isNotEmpty(message) ? message : DEFAULT_WARNING_MSG) + " : " + warning);
|
||||
while ( warning != null ) {
|
||||
StringBuffer buf = new StringBuffer( 30 )
|
||||
.append( "SQL Warning: " )
|
||||
.append( warning.getErrorCode() )
|
||||
.append( ", SQLState: " )
|
||||
.append( warning.getSQLState() );
|
||||
LOG.warningProperties(buf.toString());
|
||||
LOG.warningMessage(warning.getMessage());
|
||||
LOG.warn(buf.toString());
|
||||
LOG.warn(warning.getMessage());
|
||||
warning = warning.getNextWarning();
|
||||
}
|
||||
}
|
||||
|
@ -196,62 +191,17 @@ public class SQLExceptionHelper {
|
|||
*/
|
||||
public void logExceptions(SQLException sqlException, String message) {
|
||||
if (LOG.isEnabled(ERROR)) {
|
||||
LOG.errorPreamble(StringHelper.isNotEmpty(message) ? message : DEFAULT_EXCEPTION_MSG, sqlException);
|
||||
LOG.debug((StringHelper.isNotEmpty(message) ? message : DEFAULT_EXCEPTION_MSG) + " : " + sqlException);
|
||||
while ( sqlException != null ) {
|
||||
StringBuffer buf = new StringBuffer( 30 )
|
||||
.append( "SQL Error: " )
|
||||
.append( sqlException.getErrorCode() )
|
||||
.append( ", SQLState: " )
|
||||
.append( sqlException.getSQLState() );
|
||||
LOG.errorProperties(buf.toString());
|
||||
LOG.errorMessage(sqlException.getMessage());
|
||||
LOG.warn(buf.toString());
|
||||
LOG.error(sqlException.getMessage());
|
||||
sqlException = sqlException.getNextException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "On release of batch it still contained JDBC statements" )
|
||||
void batchContainedStatementsOnRelease();
|
||||
|
||||
@LogMessage( level = ERROR )
|
||||
@Message( value = "%s" )
|
||||
void errorMessage( String message );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "%s : %s" )
|
||||
void errorPreamble( String string,
|
||||
SQLException sqlException );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "%s" )
|
||||
void errorProperties( String string );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Could not clear warnings : %s" )
|
||||
void unableToClearWarnings( SQLException sqle );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Could not log warnings : %s" )
|
||||
void unableToLogWarnings( SQLException sqle );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "%s" )
|
||||
void warningMessage( String message );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "%s : %s" )
|
||||
void warningPreamble( String message,
|
||||
SQLWarning warning );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "%s" )
|
||||
void warningProperties( String string );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,12 +23,8 @@
|
|||
*/
|
||||
package org.hibernate.engine.jdbc.spi;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.jdbc.util.FormatStyle;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Centralize logging for SQL statements.
|
||||
|
@ -95,19 +91,8 @@ public class SQLStatementLogger {
|
|||
public void logStatement(String statement) {
|
||||
// for now just assume a DML log for formatting
|
||||
if (format && (logToStdout || LOG.isDebugEnabled())) statement = FormatStyle.BASIC.getFormatter().format(statement);
|
||||
LOG.statement(statement);
|
||||
LOG.debug(statement);
|
||||
if (logToStdout) System.out.println("Hibernate: " + statement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "%s" )
|
||||
void statement( String statement );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,9 +24,6 @@
|
|||
*/
|
||||
package org.hibernate.engine.loading;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.io.Serializable;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
|
@ -36,6 +33,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import org.hibernate.CacheMode;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.cache.CacheKey;
|
||||
import org.hibernate.cache.entry.CollectionCacheEntry;
|
||||
import org.hibernate.collection.PersistentCollection;
|
||||
|
@ -46,10 +44,6 @@ import org.hibernate.engine.SessionImplementor;
|
|||
import org.hibernate.engine.Status;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Represents state associated with the processing of a given {@link ResultSet}
|
||||
|
@ -114,16 +108,18 @@ public class CollectionLoadContext {
|
|||
public PersistentCollection getLoadingCollection(final CollectionPersister persister, final Serializable key) {
|
||||
final EntityMode em = loadContexts.getPersistenceContext().getSession().getEntityMode();
|
||||
final CollectionKey collectionKey = new CollectionKey( persister, key, em );
|
||||
if (LOG.isTraceEnabled()) LOG.findingLoadingCollection(MessageHelper.collectionInfoString(persister.getRole(), key));
|
||||
if (LOG.isTraceEnabled()) LOG.trace("Starting attempt to find loading collection ["
|
||||
+ MessageHelper.collectionInfoString(persister.getRole(), key) + "]");
|
||||
final LoadingCollectionEntry loadingCollectionEntry = loadContexts.locateLoadingCollectionEntry( collectionKey );
|
||||
if ( loadingCollectionEntry == null ) {
|
||||
// look for existing collection as part of the persistence context
|
||||
PersistentCollection collection = loadContexts.getPersistenceContext().getCollection( collectionKey );
|
||||
if ( collection != null ) {
|
||||
if ( collection.wasInitialized() ) {
|
||||
LOG.collectionAlreadyInitialized();
|
||||
LOG.trace("Collection already initialized; ignoring");
|
||||
return null; // ignore this row of results! Note the early exit
|
||||
} else LOG.collectionNotYetInitialized();
|
||||
}
|
||||
LOG.trace("Collection not yet initialized; initializing");
|
||||
}
|
||||
else {
|
||||
Object owner = loadContexts.getPersistenceContext().getCollectionOwner( key, persister );
|
||||
|
@ -133,15 +129,14 @@ public class CollectionLoadContext {
|
|||
if ( newlySavedEntity ) {
|
||||
// important, to account for newly saved entities in query
|
||||
// todo : some kind of check for new status...
|
||||
LOG.owningEntityAlreadyLoaded();
|
||||
LOG.trace("Owning entity already loaded; ignoring");
|
||||
return null;
|
||||
}
|
||||
else {
|
||||
// create one
|
||||
LOG.instantiatingNewCollection(key, resultSet);
|
||||
collection = persister.getCollectionType()
|
||||
.instantiate( loadContexts.getPersistenceContext().getSession(), persister, key );
|
||||
}
|
||||
// create one
|
||||
LOG.trace("Instantiating new collection [key=" + key + ", rs=" + resultSet + "]");
|
||||
collection = persister.getCollectionType().instantiate(loadContexts.getPersistenceContext().getSession(),
|
||||
persister,
|
||||
key);
|
||||
}
|
||||
collection.beforeInitialize( persister, -1 );
|
||||
collection.beginRead();
|
||||
|
@ -149,18 +144,14 @@ public class CollectionLoadContext {
|
|||
loadContexts.registerLoadingCollectionXRef( collectionKey, new LoadingCollectionEntry( resultSet, persister, key, collection ) );
|
||||
return collection;
|
||||
}
|
||||
else {
|
||||
if ( loadingCollectionEntry.getResultSet() == resultSet ) {
|
||||
LOG.foundLoadingCollection();
|
||||
return loadingCollectionEntry.getCollection();
|
||||
}
|
||||
else {
|
||||
// ignore this row, the collection is in process of
|
||||
// being loaded somewhere further "up" the stack
|
||||
LOG.collectionAlreadyInitializing();
|
||||
return null;
|
||||
}
|
||||
if (loadingCollectionEntry.getResultSet() == resultSet) {
|
||||
LOG.trace("Found loading collection bound to current result set processing; reading row");
|
||||
return loadingCollectionEntry.getCollection();
|
||||
}
|
||||
// ignore this row, the collection is in process of
|
||||
// being loaded somewhere further "up" the stack
|
||||
LOG.trace("Collection is already being initialized; ignoring row");
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -200,7 +191,7 @@ public class CollectionLoadContext {
|
|||
lce.getCollection()
|
||||
);
|
||||
}
|
||||
LOG.removingCollectionLoadEntry(lce);
|
||||
LOG.trace("Removing collection load entry [" + lce + "]");
|
||||
|
||||
// todo : i'd much rather have this done from #endLoadingCollection(CollectionPersister,LoadingCollectionEntry)...
|
||||
loadContexts.unregisterLoadingCollectionXRef( collectionKey );
|
||||
|
@ -222,23 +213,23 @@ public class CollectionLoadContext {
|
|||
|
||||
private void endLoadingCollections(CollectionPersister persister, List matchedCollectionEntries) {
|
||||
if ( matchedCollectionEntries == null ) {
|
||||
LOG.noCollectionFoundInResultSet(persister.getRole());
|
||||
LOG.debug("No collections were found in result set for role: " + persister.getRole());
|
||||
return;
|
||||
}
|
||||
|
||||
final int count = matchedCollectionEntries.size();
|
||||
LOG.collectionsFound(count, persister.getRole());
|
||||
LOG.debug(count + " collections were found in result set for role: " + persister.getRole());
|
||||
|
||||
for ( int i = 0; i < count; i++ ) {
|
||||
LoadingCollectionEntry lce = ( LoadingCollectionEntry ) matchedCollectionEntries.get( i );
|
||||
endLoadingCollection( lce, persister );
|
||||
}
|
||||
|
||||
LOG.collectionsInitialized(count, persister.getRole());
|
||||
LOG.debug(count + " collections initialized for role: " + persister.getRole());
|
||||
}
|
||||
|
||||
private void endLoadingCollection(LoadingCollectionEntry lce, CollectionPersister persister) {
|
||||
LOG.endingLoadingCollection(lce);
|
||||
LOG.trace("Ending loading collection [" + lce + "]");
|
||||
final SessionImplementor session = getLoadContext().getPersistenceContext().getSession();
|
||||
final EntityMode em = session.getEntityMode();
|
||||
|
||||
|
@ -260,16 +251,11 @@ public class CollectionLoadContext {
|
|||
persister.hasCache() && // and the role has a cache
|
||||
session.getCacheMode().isPutEnabled() &&
|
||||
!ce.isDoremove(); // and this is not a forced initialization during flush
|
||||
if ( addToCache ) {
|
||||
addCollectionToCache( lce, persister );
|
||||
}
|
||||
if (addToCache) addCollectionToCache(lce, persister);
|
||||
|
||||
if (LOG.isDebugEnabled()) LOG.collectionInitialized(MessageHelper.collectionInfoString(persister,
|
||||
lce.getKey(),
|
||||
session.getFactory()));
|
||||
if ( session.getFactory().getStatistics().isStatisticsEnabled() ) {
|
||||
session.getFactory().getStatisticsImplementor().loadCollection( persister.getRole() );
|
||||
}
|
||||
if (LOG.isDebugEnabled()) LOG.debug("Collection fully initialized: "
|
||||
+ MessageHelper.collectionInfoString(persister, lce.getKey(), session.getFactory()));
|
||||
if (session.getFactory().getStatistics().isStatisticsEnabled()) session.getFactory().getStatisticsImplementor().loadCollection(persister.getRole());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -282,11 +268,12 @@ public class CollectionLoadContext {
|
|||
final SessionImplementor session = getLoadContext().getPersistenceContext().getSession();
|
||||
final SessionFactoryImplementor factory = session.getFactory();
|
||||
|
||||
if (LOG.isDebugEnabled()) LOG.cachingCollection(MessageHelper.collectionInfoString(persister, lce.getKey(), factory));
|
||||
if (LOG.isDebugEnabled()) LOG.debug("Caching collection: "
|
||||
+ MessageHelper.collectionInfoString(persister, lce.getKey(), factory));
|
||||
|
||||
if ( !session.getEnabledFilters().isEmpty() && persister.isAffectedByEnabledFilters( session ) ) {
|
||||
// some filters affecting the collection are enabled on the session, so do not do the put into the cache.
|
||||
LOG.notAddingToCache();
|
||||
LOG.debug("Refusing to add to cache due to enabled filters");
|
||||
// todo : add the notion of enabled filters to the CacheKey to differentiate filtered collections from non-filtered;
|
||||
// but CacheKey is currently used for both collections and entities; would ideally need to define two seperate ones;
|
||||
// currently this works in conjuction with the check on
|
||||
|
@ -336,82 +323,4 @@ public class CollectionLoadContext {
|
|||
public String toString() {
|
||||
return super.toString() + "<rs=" + resultSet + ">";
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Caching collection: %s" )
|
||||
void cachingCollection( String collectionInfoString );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Collection already initialized; ignoring" )
|
||||
void collectionAlreadyInitialized();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Collection is already being initialized; ignoring row" )
|
||||
void collectionAlreadyInitializing();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Collection fully initialized: %s" )
|
||||
void collectionInitialized( String collectionInfoString );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Collection not yet initialized; initializing" )
|
||||
void collectionNotYetInitialized();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "%d collections were found in result set for role: %s" )
|
||||
void collectionsFound( int count,
|
||||
String role );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "%d collections initialized for role: %s" )
|
||||
void collectionsInitialized( int count,
|
||||
String role );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Ending loading collection [%s]" )
|
||||
void endingLoadingCollection( LoadingCollectionEntry lce );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Starting attempt to find loading collection [%s]" )
|
||||
void findingLoadingCollection( String collectionInfoString );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Found loading collection bound to current result set processing; reading row" )
|
||||
void foundLoadingCollection();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Instantiating new collection [key=%s, rs=%s]" )
|
||||
void instantiatingNewCollection( Serializable key,
|
||||
ResultSet resultSet );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "In CollectionLoadContext#endLoadingCollections, localLoadingCollectionKeys contained [%s], but no LoadingCollectionEntry was found in loadContexts" )
|
||||
void loadingCollectionKeyNotFound( CollectionKey collectionKey );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "On CollectionLoadContext#cleanup, localLoadingCollectionKeys contained [%d] entries" )
|
||||
void localLoadingCollectionKeysCount( int size );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "No collections were found in result set for role: %s" )
|
||||
void noCollectionFoundInResultSet( String role );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Refusing to add to cache due to enabled filters" )
|
||||
void notAddingToCache();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Owning entity already loaded; ignoring" )
|
||||
void owningEntityAlreadyLoaded();
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Removing collection load entry [%s]" )
|
||||
void removingCollectionLoadEntry( LoadingCollectionEntry lce );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,14 +24,10 @@
|
|||
*/
|
||||
package org.hibernate.engine.loading;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
import org.hibernate.Logger;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -62,15 +58,4 @@ public class EntityLoadContext {
|
|||
public String toString() {
|
||||
return super.toString() + "<rs=" + resultSet + ">";
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "On EntityLoadContext#clear, hydratingEntities contained [%d] entries" )
|
||||
void hydratingEntitiesCount( int size );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
*/
|
||||
package org.hibernate.engine.loading;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.io.Serializable;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.HashMap;
|
||||
|
@ -33,6 +31,7 @@ import java.util.Iterator;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.hibernate.EntityMode;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.collection.PersistentCollection;
|
||||
import org.hibernate.engine.CollectionKey;
|
||||
import org.hibernate.engine.PersistenceContext;
|
||||
|
@ -40,10 +39,6 @@ import org.hibernate.engine.SessionImplementor;
|
|||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.hibernate.util.IdentityMap;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Maps {@link ResultSet result-sets} to specific contextual data
|
||||
|
@ -184,14 +179,10 @@ public class LoadContexts {
|
|||
*/
|
||||
public CollectionLoadContext getCollectionLoadContext(ResultSet resultSet) {
|
||||
CollectionLoadContext context = null;
|
||||
if ( collectionLoadContexts == null ) {
|
||||
collectionLoadContexts = IdentityMap.instantiate( 8 );
|
||||
}
|
||||
else {
|
||||
context = ( CollectionLoadContext ) collectionLoadContexts.get( resultSet );
|
||||
}
|
||||
if (collectionLoadContexts == null) collectionLoadContexts = IdentityMap.instantiate(8);
|
||||
else context = (CollectionLoadContext)collectionLoadContexts.get(resultSet);
|
||||
if ( context == null ) {
|
||||
LOG.constructingCollectionLoadContext(resultSet);
|
||||
LOG.trace("Constructing collection load context for result set [" + resultSet + "]");
|
||||
context = new CollectionLoadContext( this, resultSet );
|
||||
collectionLoadContexts.put( resultSet, context );
|
||||
}
|
||||
|
@ -209,15 +200,13 @@ public class LoadContexts {
|
|||
public PersistentCollection locateLoadingCollection(CollectionPersister persister, Serializable ownerKey) {
|
||||
LoadingCollectionEntry lce = locateLoadingCollectionEntry( new CollectionKey( persister, ownerKey, getEntityMode() ) );
|
||||
if ( lce != null ) {
|
||||
if (LOG.isTraceEnabled()) LOG.returningLoadingCollection(MessageHelper.collectionInfoString(persister,
|
||||
ownerKey,
|
||||
getSession().getFactory()));
|
||||
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.creatingCollectionWrapper(MessageHelper.collectionInfoString(persister,
|
||||
ownerKey,
|
||||
getSession().getFactory()));
|
||||
if (LOG.isTraceEnabled()) LOG.trace("Creating collection wrapper: "
|
||||
+ MessageHelper.collectionInfoString(persister, ownerKey, getSession().getFactory()));
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -283,13 +272,11 @@ public class LoadContexts {
|
|||
* @return The located entry; or null.
|
||||
*/
|
||||
LoadingCollectionEntry locateLoadingCollectionEntry(CollectionKey key) {
|
||||
if ( xrefLoadingCollectionEntries == null ) {
|
||||
return null;
|
||||
}
|
||||
LOG.locatingLoadingCollectionEntry(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.collectionNotLocated(key);
|
||||
else LOG.collectionLocated(key);
|
||||
if (rtn == null) LOG.trace("Collection [" + key + "] not located in load context");
|
||||
else LOG.trace("Collection [" + key + "] located in load context");
|
||||
return rtn;
|
||||
}
|
||||
|
||||
|
@ -319,43 +306,4 @@ public class LoadContexts {
|
|||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Collection [%s] located in load context" )
|
||||
void collectionLocated( CollectionKey key );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Collection [%s] not located in load context" )
|
||||
void collectionNotLocated( CollectionKey key );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Constructing collection load context for result set [%s]" )
|
||||
void constructingCollectionLoadContext( ResultSet resultSet );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Creating collection wrapper: %s" )
|
||||
void creatingCollectionWrapper( String collectionInfoString );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Fail-safe cleanup (collections) : %s" )
|
||||
void failSafeCleanup( CollectionLoadContext collectionLoadContext );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Fail-safe cleanup (entities) : %s" )
|
||||
void failSafeCleanup( EntityLoadContext entityLoadContext );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Attempting to locate loading collection entry [%s] in any result-set context" )
|
||||
void locatingLoadingCollectionEntry( CollectionKey key );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Returning loading collection: %s" )
|
||||
void returningLoadingCollection( String collectionInfoString );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,17 +23,12 @@
|
|||
*/
|
||||
package org.hibernate.engine.profile;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.engine.SessionFactoryImplementor;
|
||||
import org.hibernate.type.BagType;
|
||||
import org.hibernate.type.Type;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* A 'fetch profile' allows a user to dynamically modify the fetching strategy used for particular associations at
|
||||
|
@ -96,7 +91,7 @@ public class FetchProfile {
|
|||
public void addFetch(Fetch fetch) {
|
||||
Type associationType = fetch.getAssociation().getOwner().getPropertyType( fetch.getAssociation().getAssociationPath() );
|
||||
if ( associationType.isCollectionType() ) {
|
||||
LOG.addingFetch(fetch.getAssociation().getRole());
|
||||
LOG.trace("Handling request to add collection fetch [" + fetch.getAssociation().getRole() + "]");
|
||||
|
||||
// couple of things for which to account in the case of collection
|
||||
// join fetches
|
||||
|
@ -170,23 +165,4 @@ public class FetchProfile {
|
|||
public boolean isContainsJoinFetchedBag() {
|
||||
return containsJoinFetchedBag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Handling request to add collection fetch [%s]" )
|
||||
void addingFetch( String role );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Ignoring bag join fetch [%s] due to prior collection join fetch" )
|
||||
void containsJoinFetchedCollection( String role );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Unable to erase previously added bag join fetch" )
|
||||
void unableToRemoveBagJoinFetch();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,6 @@
|
|||
*/
|
||||
package org.hibernate.engine.query;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import static org.jboss.logging.Logger.Level.WARN;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -35,6 +33,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.ScrollableResults;
|
||||
import org.hibernate.engine.QueryParameters;
|
||||
|
@ -51,10 +50,6 @@ import org.hibernate.util.ArrayHelper;
|
|||
import org.hibernate.util.EmptyIterator;
|
||||
import org.hibernate.util.IdentitySet;
|
||||
import org.hibernate.util.JoinedIterator;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Defines a query execution plan for an HQL query (or filter).
|
||||
|
@ -175,7 +170,7 @@ public class HQLQueryPlan implements Serializable {
|
|||
QueryParameters queryParameters,
|
||||
SessionImplementor session) throws HibernateException {
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.find(getSourceQuery());
|
||||
LOG.trace("Find: " + getSourceQuery());
|
||||
queryParameters.traceParameters( session.getFactory() );
|
||||
}
|
||||
boolean hasLimit = queryParameters.getRowSelection() != null &&
|
||||
|
@ -234,7 +229,7 @@ public class HQLQueryPlan implements Serializable {
|
|||
QueryParameters queryParameters,
|
||||
EventSource session) throws HibernateException {
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.iterate(getSourceQuery());
|
||||
LOG.trace("Iterate: " + getSourceQuery());
|
||||
queryParameters.traceParameters( session.getFactory() );
|
||||
}
|
||||
if ( translators.length == 0 ) {
|
||||
|
@ -260,7 +255,7 @@ public class HQLQueryPlan implements Serializable {
|
|||
QueryParameters queryParameters,
|
||||
SessionImplementor session) throws HibernateException {
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.iterate(getSourceQuery());
|
||||
LOG.trace("Iterate: " + getSourceQuery());
|
||||
queryParameters.traceParameters( session.getFactory() );
|
||||
}
|
||||
if ( translators.length != 1 ) {
|
||||
|
@ -276,7 +271,7 @@ public class HQLQueryPlan implements Serializable {
|
|||
public int performExecuteUpdate(QueryParameters queryParameters, SessionImplementor session)
|
||||
throws HibernateException {
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.executeUpdate(getSourceQuery());
|
||||
LOG.trace("Execute update: " + getSourceQuery());
|
||||
queryParameters.traceParameters( session.getFactory() );
|
||||
}
|
||||
if (translators.length != 1) LOG.splitQueries(getSourceQuery(), translators.length);
|
||||
|
@ -291,7 +286,7 @@ public class HQLQueryPlan implements Serializable {
|
|||
long start = System.currentTimeMillis();
|
||||
ParamLocationRecognizer recognizer = ParamLocationRecognizer.parseLocations( hql );
|
||||
long end = System.currentTimeMillis();
|
||||
LOG.hqlParamLocationRecognition(end - start, hql);
|
||||
LOG.trace("HQL param location recognition took " + (end - start) + " mills (" + hql + ")");
|
||||
|
||||
int ordinalParamCount = parameterTranslations.getOrdinalParameterCount();
|
||||
int[] locations = ArrayHelper.toIntArray( recognizer.getOrdinalParameterLocationList() );
|
||||
|
@ -336,37 +331,4 @@ public class HQLQueryPlan implements Serializable {
|
|||
System.arraycopy(translators, 0, copy, 0, copy.length);
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Execute update: %s" )
|
||||
void executeUpdate( String sourceQuery );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Find: %s" )
|
||||
void find( String sourceQuery );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "HQL param location recognition took %d mills (%s)" )
|
||||
void hqlParamLocationRecognition( long l,
|
||||
String hql );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Iterate: %s" )
|
||||
void iterate( String sourceQuery );
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "FirstResult/maxResults specified on polymorphic query; applying in memory!" )
|
||||
void needsLimit();
|
||||
|
||||
@LogMessage( level = WARN )
|
||||
@Message( value = "Manipulation query [%s] resulted in [%d] split queries" )
|
||||
void splitQueries( String sourceQuery,
|
||||
int length );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
*/
|
||||
package org.hibernate.engine.query;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
@ -32,6 +31,7 @@ import java.util.Iterator;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.action.BulkOperationCleanupAction;
|
||||
import org.hibernate.engine.QueryParameters;
|
||||
|
@ -43,10 +43,6 @@ import org.hibernate.event.EventSource;
|
|||
import org.hibernate.loader.custom.sql.SQLCustomQuery;
|
||||
import org.hibernate.type.Type;
|
||||
import org.hibernate.util.ArrayHelper;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Defines a query execution plan for a native-SQL query.
|
||||
|
@ -157,7 +153,7 @@ public class NativeSQLQueryPlan implements Serializable {
|
|||
TypedValue typedval = (TypedValue) e.getValue();
|
||||
int[] locs = getNamedParameterLocs( name );
|
||||
for (int i = 0; i < locs.length; i++) {
|
||||
LOG.bindNamedParameters(typedval.getValue(), name, locs[i] + start);
|
||||
LOG.debug("bindNamedParameters() " + typedval.getValue() + " -> " + name + " [" + (locs[i] + start) + "]");
|
||||
typedval.getType().nullSafeSet( ps, typedval.getValue(),
|
||||
locs[i] + start, session );
|
||||
}
|
||||
|
@ -220,17 +216,4 @@ public class NativeSQLQueryPlan implements Serializable {
|
|||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "bindNamedParameters() %s -> %s [%d]" )
|
||||
void bindNamedParameters( Object value,
|
||||
String name,
|
||||
int i );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@
|
|||
*/
|
||||
package org.hibernate.engine.query;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import java.io.Serializable;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
@ -32,6 +31,7 @@ import java.util.HashSet;
|
|||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.cfg.Environment;
|
||||
|
@ -42,10 +42,6 @@ import org.hibernate.internal.util.config.ConfigurationHelper;
|
|||
import org.hibernate.util.CollectionHelper;
|
||||
import org.hibernate.util.SimpleMRUCache;
|
||||
import org.hibernate.util.SoftLimitMRUCache;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Acts as a cache for compiled query plans, as well as query-parameter metadata.
|
||||
|
@ -120,9 +116,9 @@ public class QueryPlanCache implements Serializable {
|
|||
HQLQueryPlan plan = ( HQLQueryPlan ) planCache.get ( key );
|
||||
|
||||
if ( plan == null ) {
|
||||
LOG.unableToLocateHqlQuery(queryString);
|
||||
LOG.trace("Unable to locate HQL query plan in cache; generating (" + queryString + ")");
|
||||
plan = new HQLQueryPlan(queryString, shallow, enabledFilters, factory );
|
||||
} else LOG.locatedHqlQuery(queryString);
|
||||
} else LOG.trace("Located HQL query plan in cache (" + queryString + ")");
|
||||
|
||||
planCache.put( key, plan );
|
||||
|
||||
|
@ -135,9 +131,10 @@ public class QueryPlanCache implements Serializable {
|
|||
FilterQueryPlan plan = ( FilterQueryPlan ) planCache.get ( key );
|
||||
|
||||
if ( plan == null ) {
|
||||
LOG.unableToLocateCollectionFilter(collectionRole, filterString);
|
||||
LOG.trace("Unable to locate collection-filter query plan in cache; generating (" + collectionRole + " : "
|
||||
+ filterString + ")");
|
||||
plan = new FilterQueryPlan( filterString, collectionRole, shallow, enabledFilters, factory );
|
||||
} else LOG.locatedCollectionFilter(collectionRole, filterString);
|
||||
} else LOG.trace("Located collection-filter query plan in cache (" + collectionRole + " : " + filterString + ")");
|
||||
|
||||
planCache.put( key, plan );
|
||||
|
||||
|
@ -148,9 +145,9 @@ public class QueryPlanCache implements Serializable {
|
|||
NativeSQLQueryPlan plan = ( NativeSQLQueryPlan ) planCache.get( spec );
|
||||
|
||||
if ( plan == null ) {
|
||||
LOG.unableToLocationNativeSqlQueryPlan(spec.getQueryString());
|
||||
LOG.trace("Unable to locate native-sql query plan in cache; generating (" + spec.getQueryString() + ")");
|
||||
plan = new NativeSQLQueryPlan( spec, factory );
|
||||
} else LOG.locatedNativeSqlQueryPlan(spec.getQueryString());
|
||||
} else LOG.trace("Located native-sql query plan in cache (" + spec.getQueryString() + ")");
|
||||
|
||||
planCache.put( spec, plan );
|
||||
return plan;
|
||||
|
@ -345,37 +342,4 @@ public class QueryPlanCache implements Serializable {
|
|||
return hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Located collection-filter query plan in cache (%s : %s)" )
|
||||
void locatedCollectionFilter( String collectionRole,
|
||||
String filterString );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Located HQL query plan in cache (%s)" )
|
||||
void locatedHqlQuery( String queryString );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Located native-sql query plan in cache (%s)" )
|
||||
void locatedNativeSqlQueryPlan( String queryString );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Unable to locate collection-filter query plan in cache; generating (%s : %s)" )
|
||||
void unableToLocateCollectionFilter( String collectionRole,
|
||||
String filterString );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Unable to locate HQL query plan in cache; generating (%s)" )
|
||||
void unableToLocateHqlQuery( String queryString );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Unable to locate native-sql query plan in cache; generating (%s)" )
|
||||
void unableToLocationNativeSqlQueryPlan( String queryString );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,9 +24,6 @@
|
|||
*/
|
||||
package org.hibernate.engine.transaction;
|
||||
|
||||
import static org.jboss.logging.Logger.Level.DEBUG;
|
||||
import static org.jboss.logging.Logger.Level.INFO;
|
||||
import static org.jboss.logging.Logger.Level.TRACE;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import javax.transaction.NotSupportedException;
|
||||
|
@ -34,14 +31,9 @@ import javax.transaction.SystemException;
|
|||
import javax.transaction.Transaction;
|
||||
import javax.transaction.TransactionManager;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.Logger;
|
||||
import org.hibernate.engine.SessionImplementor;
|
||||
import org.hibernate.engine.jdbc.spi.SQLExceptionHelper;
|
||||
import org.hibernate.exception.JDBCExceptionHelper;
|
||||
import org.hibernate.exception.SQLExceptionConverter;
|
||||
import org.jboss.logging.BasicLogger;
|
||||
import org.jboss.logging.LogMessage;
|
||||
import org.jboss.logging.Message;
|
||||
import org.jboss.logging.MessageLogger;
|
||||
|
||||
/**
|
||||
* Class which provides the isolation semantics required by
|
||||
|
@ -120,7 +112,7 @@ public class Isolater {
|
|||
try {
|
||||
// First we suspend any current JTA transaction
|
||||
Transaction surroundingTransaction = transactionManager.suspend();
|
||||
LOG.jtaTransactionSuspended(surroundingTransaction);
|
||||
LOG.debug("Surrounding JTA transaction suspended [" + surroundingTransaction + "]");
|
||||
|
||||
boolean hadProblems = false;
|
||||
try {
|
||||
|
@ -139,7 +131,7 @@ public class Isolater {
|
|||
finally {
|
||||
try {
|
||||
transactionManager.resume( surroundingTransaction );
|
||||
LOG.jtaTransactionResumed(surroundingTransaction);
|
||||
LOG.debug("Surrounding JTA transaction resumed [" + surroundingTransaction + "]");
|
||||
}
|
||||
catch( Throwable t ) {
|
||||
// if the actually work had an error use that, otherwise error based on t
|
||||
|
@ -304,40 +296,4 @@ public class Isolater {
|
|||
return session.getFactory().getSQLExceptionHelper();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface defining messages that may be logged by the outer class
|
||||
*/
|
||||
@MessageLogger
|
||||
interface Logger extends BasicLogger {
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "On release of batch it still contained JDBC statements" )
|
||||
void batchContainedStatementsOnRelease();
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Surrounding JTA transaction resumed [%s]" )
|
||||
void jtaTransactionResumed( Transaction surroundingTransaction );
|
||||
|
||||
@LogMessage( level = DEBUG )
|
||||
@Message( value = "Surrounding JTA transaction suspended [%s]" )
|
||||
void jtaTransactionSuspended( Transaction surroundingTransaction );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Unable to release isolated connection [%s]" )
|
||||
void unableToReleaseIsolatedConnection( Throwable ignore );
|
||||
|
||||
@LogMessage( level = TRACE )
|
||||
@Message( value = "Unable to reset connection back to auto-commit" )
|
||||
void unableToResetConnectionToAutoCommit();
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Unable to rollback connection on exception [%s]" )
|
||||
void unableToRollbackConnection( Exception ignore );
|
||||
|
||||
@LogMessage( level = INFO )
|
||||
@Message( value = "Unable to rollback isolated transaction on error [%s] : [%s]" )
|
||||
void unableToRollbackIsolatedTransaction( Exception e,
|
||||
Exception ignore );
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue