HHH-8741 - More checkstyle cleanups
This commit is contained in:
parent
ffecce514e
commit
8ec17e68e7
|
@ -40,8 +40,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
|||
* @author Sanne Grinovero
|
||||
*/
|
||||
public class DelayedPostInsertIdentifier implements Serializable, Comparable<DelayedPostInsertIdentifier> {
|
||||
|
||||
private static final AtomicLong sequence = new AtomicLong( 0 );
|
||||
private static final AtomicLong SEQUENCE = new AtomicLong( 0 );
|
||||
|
||||
private final long identifier;
|
||||
|
||||
|
@ -49,12 +48,12 @@ public class DelayedPostInsertIdentifier implements Serializable, Comparable<Del
|
|||
* Constructs a DelayedPostInsertIdentifier
|
||||
*/
|
||||
public DelayedPostInsertIdentifier() {
|
||||
long value = sequence.incrementAndGet();
|
||||
long value = SEQUENCE.incrementAndGet();
|
||||
if ( value < 0 ) {
|
||||
synchronized ( sequence ) {
|
||||
value = sequence.incrementAndGet();
|
||||
synchronized (SEQUENCE) {
|
||||
value = SEQUENCE.incrementAndGet();
|
||||
if ( value < 0 ) {
|
||||
sequence.set( 0 );
|
||||
SEQUENCE.set( 0 );
|
||||
value = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ public class CompositeOwnerTracker {
|
|||
|
||||
private String[] names;
|
||||
private CompositeOwner[] owners;
|
||||
private int size = 0;
|
||||
private int size;
|
||||
|
||||
public CompositeOwnerTracker() {
|
||||
names = new String[1];
|
||||
|
|
|
@ -34,7 +34,9 @@ import org.hibernate.engine.spi.SessionImplementor;
|
|||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class CacheHelper {
|
||||
public final class CacheHelper {
|
||||
private CacheHelper() {
|
||||
}
|
||||
|
||||
public static Serializable fromSharedCache(
|
||||
SessionImplementor session,
|
||||
|
|
|
@ -109,7 +109,7 @@ public class DriverManagerConnectionProviderImpl
|
|||
executorService = Executors.newSingleThreadScheduledExecutor();
|
||||
executorService.scheduleWithFixedDelay(
|
||||
new Runnable() {
|
||||
private boolean primed = false;
|
||||
private boolean primed;
|
||||
@Override
|
||||
public void run() {
|
||||
int size = connections.size();
|
||||
|
|
|
@ -264,7 +264,7 @@ public final class CollectionEntry implements Serializable {
|
|||
return snapshot;
|
||||
}
|
||||
|
||||
private boolean fromMerge = false;
|
||||
private boolean fromMerge;
|
||||
|
||||
/**
|
||||
* Reset the stored snapshot for both the persistent collection and this collection entry.
|
||||
|
|
|
@ -68,8 +68,8 @@ public final class QueryParameters {
|
|||
private Serializable optionalId;
|
||||
private boolean isReadOnlyInitialized;
|
||||
private boolean readOnly;
|
||||
private boolean callable = false;
|
||||
private boolean autodiscovertypes = false;
|
||||
private boolean callable;
|
||||
private boolean autodiscovertypes;
|
||||
private boolean isNaturalKeyLookup;
|
||||
|
||||
private final ResultTransformer resultTransformer; // why is all others non final ?
|
||||
|
|
|
@ -35,7 +35,10 @@ import org.hibernate.TransactionException;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class JtaStatusHelper {
|
||||
public final class JtaStatusHelper {
|
||||
private JtaStatusHelper() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract the status code from a {@link UserTransaction}
|
||||
*
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.hibernate.engine.jndi.JndiException;
|
|||
public class JBossAppServerJtaPlatform extends AbstractJtaPlatform {
|
||||
public static final String AS7_TM_NAME = "java:jboss/TransactionManager";
|
||||
public static final String AS4_TM_NAME = "java:/TransactionManager";
|
||||
public static final String JBOSS__UT_NAME = "java:jboss/UserTransaction";
|
||||
public static final String JBOSS_UT_NAME = "java:jboss/UserTransaction";
|
||||
public static final String UT_NAME = "java:comp/UserTransaction";
|
||||
|
||||
@Override
|
||||
|
@ -67,7 +67,7 @@ public class JBossAppServerJtaPlatform extends AbstractJtaPlatform {
|
|||
@Override
|
||||
protected UserTransaction locateUserTransaction() {
|
||||
try {
|
||||
return (UserTransaction) jndiService().locate( JBOSS__UT_NAME );
|
||||
return (UserTransaction) jndiService().locate( JBOSS_UT_NAME );
|
||||
}
|
||||
catch (JndiException jndiException) {
|
||||
try {
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.hibernate.cache.spi.access.SoftLock;
|
|||
import org.hibernate.engine.spi.EntityEntry;
|
||||
import org.hibernate.engine.spi.Status;
|
||||
import org.hibernate.event.spi.EventSource;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
|
||||
|
@ -43,9 +43,8 @@ import org.hibernate.pretty.MessageHelper;
|
|||
*
|
||||
* @author Gavin King
|
||||
*/
|
||||
public class AbstractLockUpgradeEventListener extends AbstractReassociateEventListener {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, AbstractLockUpgradeEventListener.class.getName() );
|
||||
public abstract class AbstractLockUpgradeEventListener extends AbstractReassociateEventListener {
|
||||
private static final Logger log = CoreLogging.logger( AbstractLockUpgradeEventListener.class );
|
||||
|
||||
/**
|
||||
* Performs a pessimistic lock upgrade on a given entity, if needed.
|
||||
|
@ -72,8 +71,12 @@ public class AbstractLockUpgradeEventListener extends AbstractReassociateEventLi
|
|||
|
||||
final EntityPersister persister = entry.getPersister();
|
||||
|
||||
if ( LOG.isTraceEnabled() ) {
|
||||
LOG.tracev( "Locking {0} in mode: {1}", MessageHelper.infoString( persister, entry.getId(), source.getFactory() ), requestedLockMode );
|
||||
if ( log.isTraceEnabled() ) {
|
||||
log.tracev(
|
||||
"Locking {0} in mode: {1}",
|
||||
MessageHelper.infoString( persister, entry.getId(), source.getFactory() ),
|
||||
requestedLockMode
|
||||
);
|
||||
}
|
||||
|
||||
final SoftLock lock;
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.hibernate.engine.spi.EntityKey;
|
|||
import org.hibernate.engine.spi.Status;
|
||||
import org.hibernate.event.spi.AbstractEvent;
|
||||
import org.hibernate.event.spi.EventSource;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.pretty.MessageHelper;
|
||||
import org.hibernate.type.TypeHelper;
|
||||
|
@ -45,9 +45,8 @@ import org.hibernate.type.TypeHelper;
|
|||
*
|
||||
* @author Gavin King
|
||||
*/
|
||||
public class AbstractReassociateEventListener implements Serializable {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, AbstractReassociateEventListener.class.getName() );
|
||||
public abstract class AbstractReassociateEventListener implements Serializable {
|
||||
private static final Logger log = CoreLogging.logger( AbstractReassociateEventListener.class );
|
||||
|
||||
/**
|
||||
* Associates a given entity (either transient or associated with another session) to
|
||||
|
@ -62,8 +61,11 @@ public class AbstractReassociateEventListener implements Serializable {
|
|||
*/
|
||||
protected final EntityEntry reassociate(AbstractEvent event, Object object, Serializable id, EntityPersister persister) {
|
||||
|
||||
if ( LOG.isTraceEnabled() ) {
|
||||
LOG.tracev( "Reassociating transient instance: {0}", MessageHelper.infoString( persister, id, event.getSession().getFactory() ) );
|
||||
if ( log.isTraceEnabled() ) {
|
||||
log.tracev(
|
||||
"Reassociating transient instance: {0}",
|
||||
MessageHelper.infoString( persister, id, event.getSession().getFactory() )
|
||||
);
|
||||
}
|
||||
|
||||
final EventSource source = event.getSession();
|
||||
|
|
|
@ -45,6 +45,7 @@ import org.hibernate.engine.spi.Status;
|
|||
import org.hibernate.event.spi.EventSource;
|
||||
import org.hibernate.event.spi.FlushEntityEvent;
|
||||
import org.hibernate.event.spi.FlushEntityEventListener;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
|
@ -57,9 +58,7 @@ import org.hibernate.type.Type;
|
|||
* @author Gavin King
|
||||
*/
|
||||
public class DefaultFlushEntityEventListener implements FlushEntityEventListener {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
DefaultFlushEntityEventListener.class.getName());
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( DefaultFlushEntityEventListener.class );
|
||||
|
||||
/**
|
||||
* make sure user didn't mangle the id
|
||||
|
@ -499,7 +498,7 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
|
|||
else {
|
||||
// see if the custom dirtiness strategy can tell us...
|
||||
class DirtyCheckContextImpl implements CustomEntityDirtinessStrategy.DirtyCheckContext {
|
||||
int[] found = null;
|
||||
int[] found;
|
||||
@Override
|
||||
public void doDirtyChecking(CustomEntityDirtinessStrategy.AttributeChecker attributeChecker) {
|
||||
found = new DirtyCheckAttributeInfoImpl( event ).visitAttributes( attributeChecker );
|
||||
|
@ -588,7 +587,7 @@ public class DefaultFlushEntityEventListener implements FlushEntityEventListener
|
|||
private final FlushEntityEvent event;
|
||||
private final EntityPersister persister;
|
||||
private final int numberOfAttributes;
|
||||
private int index = 0;
|
||||
private int index;
|
||||
|
||||
private DirtyCheckAttributeInfoImpl(FlushEntityEvent event) {
|
||||
this.event = event;
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.hibernate.type.CollectionType;
|
|||
*/
|
||||
public class DirtyCollectionSearchVisitor extends AbstractVisitor {
|
||||
|
||||
private boolean dirty = false;
|
||||
private boolean dirty;
|
||||
private boolean[] propertyVersionability;
|
||||
|
||||
DirtyCollectionSearchVisitor(EventSource session, boolean[] propertyVersionability) {
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.hibernate.collection.spi.PersistentCollection;
|
|||
import org.hibernate.engine.spi.PersistenceContext;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.event.spi.EventSource;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.persister.collection.CollectionPersister;
|
||||
import org.hibernate.persister.entity.EntityPersister;
|
||||
|
@ -44,10 +45,9 @@ import org.hibernate.type.Type;
|
|||
* @author Gavin King
|
||||
*/
|
||||
public class WrapVisitor extends ProxyVisitor {
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( WrapVisitor.class );
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, WrapVisitor.class.getName());
|
||||
|
||||
boolean substitute = false;
|
||||
boolean substitute;
|
||||
|
||||
boolean isSubstitutionRequired() {
|
||||
return substitute;
|
||||
|
|
|
@ -98,7 +98,7 @@ public class EventType<T> {
|
|||
* Maintain a map of {@link EventType} instances keyed by name for lookup by name as well as {@link #values()}
|
||||
* resolution.
|
||||
*/
|
||||
public static final Map<String,EventType> eventTypeByNameMap = AccessController.doPrivileged(
|
||||
private static final Map<String,EventType> EVENT_TYPE_BY_NAME_MAP = AccessController.doPrivileged(
|
||||
new PrivilegedAction<Map<String, EventType>>() {
|
||||
@Override
|
||||
public Map<String, EventType> run() {
|
||||
|
@ -132,7 +132,7 @@ public class EventType<T> {
|
|||
if ( eventName == null ) {
|
||||
throw new HibernateException( "event name to resolve cannot be null" );
|
||||
}
|
||||
final EventType eventType = eventTypeByNameMap.get( eventName );
|
||||
final EventType eventType = EVENT_TYPE_BY_NAME_MAP.get( eventName );
|
||||
if ( eventType == null ) {
|
||||
throw new HibernateException( "Unable to locate proper event type for event name [" + eventName + "]" );
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ public class EventType<T> {
|
|||
* @return All {@link EventType} instances
|
||||
*/
|
||||
public static Collection<EventType> values() {
|
||||
return eventTypeByNameMap.values();
|
||||
return EVENT_TYPE_BY_NAME_MAP.values();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2013, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,43 +20,39 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.hql.internal.ast;
|
||||
import java.io.InputStream;
|
||||
|
||||
import java.io.Reader;
|
||||
|
||||
import antlr.Token;
|
||||
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.hql.internal.antlr.HqlBaseLexer;
|
||||
|
||||
import antlr.Token;
|
||||
|
||||
/**
|
||||
* Custom lexer for the HQL grammar. Extends the base lexer generated by ANTLR
|
||||
* in order to keep the grammar source file clean.
|
||||
*/
|
||||
class HqlLexer extends HqlBaseLexer {
|
||||
/**
|
||||
* A logger for this class. *
|
||||
*/
|
||||
private boolean possibleID = false;
|
||||
|
||||
public HqlLexer(InputStream in) {
|
||||
super( in );
|
||||
}
|
||||
private boolean possibleID;
|
||||
|
||||
public HqlLexer(Reader in) {
|
||||
super(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTokenObjectClass(String cl) {
|
||||
this.tokenObjectClass = HqlToken.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setPossibleID(boolean possibleID) {
|
||||
this.possibleID = possibleID;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Token makeToken(int i) {
|
||||
HqlToken token = ( HqlToken ) super.makeToken( i );
|
||||
token.setPossibleID( possibleID );
|
||||
|
@ -64,16 +60,13 @@ class HqlLexer extends HqlBaseLexer {
|
|||
return token;
|
||||
}
|
||||
|
||||
public int testLiteralsTable(int i) {
|
||||
int ttype = super.testLiteralsTable( i );
|
||||
return ttype;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void panic() {
|
||||
//overriden to avoid System.exit
|
||||
panic("CharScanner: panic");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void panic(String s) {
|
||||
//overriden to avoid System.exit
|
||||
throw new QueryException(s);
|
||||
|
|
|
@ -37,16 +37,15 @@ import antlr.ASTPair;
|
|||
import antlr.MismatchedTokenException;
|
||||
import antlr.RecognitionException;
|
||||
import antlr.Token;
|
||||
import antlr.TokenStream;
|
||||
import antlr.TokenStreamException;
|
||||
import antlr.collections.AST;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.hql.internal.antlr.HqlBaseParser;
|
||||
import org.hibernate.hql.internal.antlr.HqlTokenTypes;
|
||||
import org.hibernate.hql.internal.ast.util.ASTPrinter;
|
||||
import org.hibernate.hql.internal.ast.util.ASTUtil;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
|
||||
|
@ -57,10 +56,7 @@ import org.hibernate.internal.util.StringHelper;
|
|||
* @author Joshua Davis (pgmjsd@sourceforge.net)
|
||||
*/
|
||||
public final class HqlParser extends HqlBaseParser {
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(
|
||||
CoreMessageLogger.class,
|
||||
HqlParser.class.getName()
|
||||
);
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( HqlParser.class );
|
||||
|
||||
private final ParseErrorHandler parseErrorHandler;
|
||||
private final ASTPrinter printer = getASTPrinter();
|
||||
|
@ -91,7 +87,7 @@ public final class HqlParser extends HqlBaseParser {
|
|||
|
||||
// handle trace logging ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
private int traceDepth = 0;
|
||||
private int traceDepth;
|
||||
|
||||
@Override
|
||||
public void traceIn(String ruleName) {
|
||||
|
@ -157,8 +153,7 @@ public final class HqlParser extends HqlBaseParser {
|
|||
token.setType( HqlTokenTypes.WEIRD_IDENT );
|
||||
astFactory.addASTChild( currentAST, astFactory.create( token ) );
|
||||
consume();
|
||||
AST identifierAST = currentAST.root;
|
||||
return identifierAST;
|
||||
return currentAST.root;
|
||||
}
|
||||
} // if
|
||||
} // if
|
||||
|
|
|
@ -36,6 +36,11 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import antlr.ASTFactory;
|
||||
import antlr.RecognitionException;
|
||||
import antlr.SemanticException;
|
||||
import antlr.collections.AST;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.engine.internal.JoinSequence;
|
||||
|
@ -81,6 +86,7 @@ import org.hibernate.hql.internal.ast.util.SyntheticAndFactory;
|
|||
import org.hibernate.hql.spi.QueryTranslator;
|
||||
import org.hibernate.id.BulkInsertionCapableIdentifierGenerator;
|
||||
import org.hibernate.id.IdentifierGenerator;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
|
@ -98,12 +104,6 @@ import org.hibernate.type.DbTimestampType;
|
|||
import org.hibernate.type.Type;
|
||||
import org.hibernate.type.VersionType;
|
||||
import org.hibernate.usertype.UserVersionType;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import antlr.ASTFactory;
|
||||
import antlr.RecognitionException;
|
||||
import antlr.SemanticException;
|
||||
import antlr.collections.AST;
|
||||
|
||||
/**
|
||||
* Implements methods used by the HQL->SQL tree transform grammar (a.k.a. the second phase).
|
||||
|
@ -117,8 +117,7 @@ import antlr.collections.AST;
|
|||
* @see SqlASTFactory
|
||||
*/
|
||||
public class HqlSqlWalker extends HqlSqlBaseWalker implements ErrorReporter, ParameterBinder.NamedParameterSource {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, HqlSqlWalker.class.getName());
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( HqlSqlWalker.class );
|
||||
|
||||
private final QueryTranslatorImpl queryTranslatorImpl;
|
||||
private final HqlParser hqlParser;
|
||||
|
@ -130,7 +129,7 @@ public class HqlSqlWalker extends HqlSqlBaseWalker implements ErrorReporter, Par
|
|||
private final ASTPrinter printer;
|
||||
private final String collectionFilterRole;
|
||||
|
||||
private FromClause currentFromClause = null;
|
||||
private FromClause currentFromClause;
|
||||
private SelectClause selectClause;
|
||||
|
||||
/**
|
||||
|
@ -182,7 +181,7 @@ public class HqlSqlWalker extends HqlSqlBaseWalker implements ErrorReporter, Par
|
|||
|
||||
// handle trace logging ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
private int traceDepth = 0;
|
||||
private int traceDepth;
|
||||
|
||||
@Override
|
||||
public void traceIn(String ruleName, AST tree) {
|
||||
|
@ -811,7 +810,7 @@ public class HqlSqlWalker extends HqlSqlBaseWalker implements ErrorReporter, Par
|
|||
AST versionValueNode = null;
|
||||
|
||||
if ( sessionFactoryHelper.getFactory().getDialect().supportsParametersInInsertSelect() ) {
|
||||
int sqlTypes[] = versionType.sqlTypes( sessionFactoryHelper.getFactory() );
|
||||
int[] sqlTypes = versionType.sqlTypes( sessionFactoryHelper.getFactory() );
|
||||
if ( sqlTypes == null || sqlTypes.length == 0 ) {
|
||||
throw new IllegalStateException( versionType.getClass() + ".sqlTypes() returns null or empty array" );
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2013, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,11 +20,9 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.hql.internal.ast;
|
||||
|
||||
|
||||
/**
|
||||
* A custom token class for the HQL grammar.
|
||||
* <p><i>NOTE:<i> This class must be public becuase it is instantiated by the ANTLR library. Ignore any suggestions
|
||||
|
@ -32,11 +30,11 @@ package org.hibernate.hql.internal.ast;
|
|||
*/
|
||||
public class HqlToken extends antlr.CommonToken {
|
||||
/**
|
||||
* True if this token could be an identifier. *
|
||||
* True if this token could be an identifier.
|
||||
*/
|
||||
private boolean possibleID = false;
|
||||
private boolean possibleID;
|
||||
/**
|
||||
* The previous token type. *
|
||||
* The previous token type.
|
||||
*/
|
||||
private int tokenType;
|
||||
|
||||
|
@ -55,6 +53,7 @@ public class HqlToken extends antlr.CommonToken {
|
|||
*
|
||||
* @param t The new token type.
|
||||
*/
|
||||
@Override
|
||||
public void setType(int t) {
|
||||
this.tokenType = getType();
|
||||
super.setType( t );
|
||||
|
@ -84,6 +83,7 @@ public class HqlToken extends antlr.CommonToken {
|
|||
*
|
||||
* @return String - The debug string.
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[\""
|
||||
+ getText()
|
||||
|
|
|
@ -31,7 +31,6 @@ import java.util.List;
|
|||
|
||||
import antlr.RecognitionException;
|
||||
import antlr.collections.AST;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.NullPrecedence;
|
||||
import org.hibernate.QueryException;
|
||||
|
@ -45,6 +44,7 @@ import org.hibernate.hql.internal.ast.tree.Node;
|
|||
import org.hibernate.hql.internal.ast.tree.ParameterContainer;
|
||||
import org.hibernate.hql.internal.ast.tree.ParameterNode;
|
||||
import org.hibernate.hql.internal.ast.util.ASTPrinter;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.param.ParameterSpecification;
|
||||
|
@ -58,10 +58,9 @@ import org.hibernate.type.Type;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class SqlGenerator extends SqlGeneratorBase implements ErrorReporter {
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( SqlGenerator.class );
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, SqlGenerator.class.getName());
|
||||
|
||||
public static boolean REGRESSION_STYLE_CROSS_JOINS = false;
|
||||
public static boolean REGRESSION_STYLE_CROSS_JOINS;
|
||||
|
||||
/**
|
||||
* all append invocations on the buf should go through this Output instance variable.
|
||||
|
@ -81,7 +80,7 @@ public class SqlGenerator extends SqlGeneratorBase implements ErrorReporter {
|
|||
|
||||
// handle trace logging ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
private int traceDepth = 0;
|
||||
private int traceDepth;
|
||||
|
||||
@Override
|
||||
public void traceIn(String ruleName, AST tree) {
|
||||
|
@ -247,6 +246,7 @@ public class SqlGenerator extends SqlGeneratorBase implements ErrorReporter {
|
|||
private int argInd;
|
||||
private final List<String> args = new ArrayList<String>(3);
|
||||
|
||||
@Override
|
||||
public void clause(String clause) {
|
||||
if ( argInd == args.size() ) {
|
||||
args.add( clause );
|
||||
|
@ -256,6 +256,7 @@ public class SqlGenerator extends SqlGeneratorBase implements ErrorReporter {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commaBetweenParameters(String comma) {
|
||||
++argInd;
|
||||
}
|
||||
|
@ -269,10 +270,12 @@ public class SqlGenerator extends SqlGeneratorBase implements ErrorReporter {
|
|||
* The default SQL writer.
|
||||
*/
|
||||
class DefaultWriter implements SqlWriter {
|
||||
@Override
|
||||
public void clause(String clause) {
|
||||
getStringBuilder().append( clause );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void commaBetweenParameters(String comma) {
|
||||
getStringBuilder().append( comma );
|
||||
}
|
||||
|
|
|
@ -24,10 +24,9 @@
|
|||
*/
|
||||
package org.hibernate.hql.internal.ast.tree;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import antlr.SemanticException;
|
||||
import antlr.collections.AST;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.QueryException;
|
||||
|
@ -60,8 +59,8 @@ public class DotNode extends FromReferenceNode implements DisplayableNode, Selec
|
|||
//
|
||||
// todo : obviously get rid of all this junk ;)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
public static boolean useThetaStyleImplicitJoins = false;
|
||||
public static boolean REGRESSION_STYLE_JOIN_SUPPRESSION = false;
|
||||
public static boolean useThetaStyleImplicitJoins;
|
||||
public static boolean REGRESSION_STYLE_JOIN_SUPPRESSION;
|
||||
public static interface IllegalCollectionDereferenceExceptionBuilder {
|
||||
public QueryException buildIllegalCollectionDereferenceException(String collectionPropertyName, FromReferenceNode lhs);
|
||||
}
|
||||
|
@ -76,13 +75,15 @@ public class DotNode extends FromReferenceNode implements DisplayableNode, Selec
|
|||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, DotNode.class.getName());
|
||||
|
||||
private static final int DEREF_UNKNOWN = 0;
|
||||
private static final int DEREF_ENTITY = 1;
|
||||
private static final int DEREF_COMPONENT = 2;
|
||||
private static final int DEREF_COLLECTION = 3;
|
||||
private static final int DEREF_PRIMITIVE = 4;
|
||||
private static final int DEREF_IDENTIFIER = 5;
|
||||
private static final int DEREF_JAVA_CONSTANT = 6;
|
||||
public static enum DereferenceType {
|
||||
UNKNOWN,
|
||||
ENTITY,
|
||||
COMPONENT,
|
||||
COLLECTION,
|
||||
PRIMITIVE,
|
||||
IDENTIFIER,
|
||||
JAVA_CONSTANT
|
||||
}
|
||||
|
||||
/**
|
||||
* The identifier that is the name of the property.
|
||||
|
@ -113,9 +114,9 @@ public class DotNode extends FromReferenceNode implements DisplayableNode, Selec
|
|||
private boolean fetch = false;
|
||||
|
||||
/**
|
||||
* The type of dereference that hapened (DEREF_xxx).
|
||||
* The type of dereference that hapened
|
||||
*/
|
||||
private int dereferenceType = DEREF_UNKNOWN;
|
||||
private DereferenceType dereferenceType = DereferenceType.UNKNOWN;
|
||||
|
||||
private FromElement impliedJoin;
|
||||
|
||||
|
@ -143,7 +144,7 @@ public class DotNode extends FromReferenceNode implements DisplayableNode, Selec
|
|||
StringBuilder buf = new StringBuilder();
|
||||
FromElement fromElement = getFromElement();
|
||||
buf.append( "{propertyName=" ).append( propertyName );
|
||||
buf.append( ",dereferenceType=" ).append( getWalker().getASTPrinter().getTokenTypeName( dereferenceType ) );
|
||||
buf.append( ",dereferenceType=" ).append( dereferenceType.name() );
|
||||
buf.append( ",getPropertyPath=" ).append( propertyPath );
|
||||
buf.append( ",path=" ).append( getPath() );
|
||||
if ( fromElement != null ) {
|
||||
|
@ -248,7 +249,7 @@ public class DotNode extends FromReferenceNode implements DisplayableNode, Selec
|
|||
if ( ! CollectionProperties.isAnyCollectionProperty( propertyName ) ) {
|
||||
checkLhsIsNotCollection();
|
||||
}
|
||||
dereferenceType = DEREF_PRIMITIVE;
|
||||
dereferenceType = DereferenceType.PRIMITIVE;
|
||||
initText();
|
||||
}
|
||||
setResolved();
|
||||
|
@ -272,7 +273,7 @@ public class DotNode extends FromReferenceNode implements DisplayableNode, Selec
|
|||
private void dereferenceCollection(CollectionType collectionType, boolean implicitJoin, boolean indexed, String classAlias, AST parent)
|
||||
throws SemanticException {
|
||||
|
||||
dereferenceType = DEREF_COLLECTION;
|
||||
dereferenceType = DereferenceType.COLLECTION;
|
||||
String role = collectionType.getRole();
|
||||
|
||||
//foo.bars.size (also handles deprecated stuff like foo.bars.maxelement for backwardness)
|
||||
|
@ -405,12 +406,16 @@ public class DotNode extends FromReferenceNode implements DisplayableNode, Selec
|
|||
|
||||
private void dereferenceEntityJoin(String classAlias, EntityType propertyType, boolean impliedJoin, AST parent)
|
||||
throws SemanticException {
|
||||
dereferenceType = DEREF_ENTITY;
|
||||
if (LOG.isDebugEnabled()) LOG.debugf("dereferenceEntityJoin() : generating join for %s in %s (%s) parent = %s",
|
||||
propertyName,
|
||||
getFromElement().getClassName(),
|
||||
classAlias == null ? "<no alias>" : classAlias,
|
||||
ASTUtil.getDebugString(parent));
|
||||
dereferenceType = DereferenceType.ENTITY;
|
||||
if ( LOG.isDebugEnabled() ) {
|
||||
LOG.debugf(
|
||||
"dereferenceEntityJoin() : generating join for %s in %s (%s) parent = %s",
|
||||
propertyName,
|
||||
getFromElement().getClassName(),
|
||||
classAlias == null ? "<no alias>" : classAlias,
|
||||
ASTUtil.getDebugString(parent)
|
||||
);
|
||||
}
|
||||
// Create a new FROM node for the referenced class.
|
||||
String associatedEntityName = propertyType.getAssociatedEntityName();
|
||||
String tableAlias = getAliasGenerator().createName( associatedEntityName );
|
||||
|
@ -575,7 +580,7 @@ public class DotNode extends FromReferenceNode implements DisplayableNode, Selec
|
|||
}
|
||||
}
|
||||
private void dereferenceComponent(AST parent) {
|
||||
dereferenceType = DEREF_COMPONENT;
|
||||
dereferenceType = DereferenceType.COMPONENT;
|
||||
setPropertyNameAndPath( parent );
|
||||
}
|
||||
|
||||
|
@ -592,7 +597,7 @@ public class DotNode extends FromReferenceNode implements DisplayableNode, Selec
|
|||
setPropertyNameAndPath( dotParent ); // Set the unresolved path in this node and the parent.
|
||||
// Set the text for the parent.
|
||||
if ( dotParent != null ) {
|
||||
dotParent.dereferenceType = DEREF_IDENTIFIER;
|
||||
dotParent.dereferenceType = DereferenceType.IDENTIFIER;
|
||||
dotParent.setText( getText() );
|
||||
dotParent.columns = getColumns();
|
||||
}
|
||||
|
@ -706,7 +711,7 @@ public class DotNode extends FromReferenceNode implements DisplayableNode, Selec
|
|||
|
||||
public void setResolvedConstant(String text) {
|
||||
path = text;
|
||||
dereferenceType = DEREF_JAVA_CONSTANT;
|
||||
dereferenceType = DereferenceType.JAVA_CONSTANT;
|
||||
setResolved(); // Don't resolve the node again.
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
*
|
||||
*/
|
||||
package org.hibernate.hql.internal.ast.tree;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
@ -33,11 +34,11 @@ import java.util.Set;
|
|||
|
||||
import antlr.SemanticException;
|
||||
import antlr.collections.AST;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.hql.internal.antlr.HqlSqlTokenTypes;
|
||||
import org.hibernate.hql.internal.ast.util.ASTIterator;
|
||||
import org.hibernate.hql.internal.ast.util.ASTUtil;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
|
||||
/**
|
||||
|
@ -46,8 +47,8 @@ import org.hibernate.internal.CoreMessageLogger;
|
|||
* @author josh
|
||||
*/
|
||||
public class FromClause extends HqlSqlWalkerNode implements HqlSqlTokenTypes, DisplayableNode {
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( FromClause.class );
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, FromClause.class.getName());
|
||||
public static final int ROOT_LEVEL = 1;
|
||||
|
||||
private int level = ROOT_LEVEL;
|
||||
|
@ -72,7 +73,7 @@ public class FromClause extends HqlSqlWalkerNode implements HqlSqlTokenTypes, Di
|
|||
/**
|
||||
* Counts the from elements as they are added.
|
||||
*/
|
||||
private int fromElementCounter = 0;
|
||||
private int fromElementCounter;
|
||||
/**
|
||||
* Implied FROM elements to add onto the end of the FROM clause.
|
||||
*/
|
||||
|
|
|
@ -29,8 +29,6 @@ import java.util.LinkedList;
|
|||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.QueryException;
|
||||
import org.hibernate.engine.internal.JoinSequence;
|
||||
import org.hibernate.hql.internal.CollectionProperties;
|
||||
|
@ -39,6 +37,7 @@ import org.hibernate.hql.internal.antlr.SqlTokenTypes;
|
|||
import org.hibernate.hql.internal.ast.TypeDiscriminatorMetadata;
|
||||
import org.hibernate.hql.internal.ast.util.ASTUtil;
|
||||
import org.hibernate.hql.spi.QueryTranslator;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.param.ParameterSpecification;
|
||||
|
@ -63,8 +62,7 @@ import org.hibernate.type.Type;
|
|||
* @author josh
|
||||
*/
|
||||
public class FromElement extends HqlSqlWalkerNode implements DisplayableNode, ParameterContainer {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, FromElement.class.getName());
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( FromElement.class );
|
||||
|
||||
private String className;
|
||||
private String classAlias;
|
||||
|
@ -72,21 +70,21 @@ public class FromElement extends HqlSqlWalkerNode implements DisplayableNode, Pa
|
|||
private String collectionTableAlias;
|
||||
private FromClause fromClause;
|
||||
private boolean includeSubclasses = true;
|
||||
private boolean collectionJoin = false;
|
||||
private boolean collectionJoin;
|
||||
private FromElement origin;
|
||||
private String[] columns;
|
||||
private String role;
|
||||
private boolean fetch;
|
||||
private boolean isAllPropertyFetch;
|
||||
private boolean filter = false;
|
||||
private boolean filter;
|
||||
private int sequence = -1;
|
||||
private boolean useFromFragment = false;
|
||||
private boolean initialized = false;
|
||||
private boolean useFromFragment;
|
||||
private boolean initialized;
|
||||
private FromElementType elementType;
|
||||
private boolean useWhereFragment = true;
|
||||
private List destinations = new LinkedList();
|
||||
private boolean manyToMany = false;
|
||||
private String withClauseFragment = null;
|
||||
private boolean manyToMany;
|
||||
private String withClauseFragment;
|
||||
private String withClauseJoinAlias;
|
||||
private boolean dereferencedBySuperclassProperty;
|
||||
private boolean dereferencedBySubclassProperty;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2013, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,14 +20,14 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.hql.internal.ast.tree;
|
||||
|
||||
import antlr.SemanticException;
|
||||
import antlr.collections.AST;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.hql.internal.antlr.HqlSqlTokenTypes;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
|
||||
/**
|
||||
|
@ -38,10 +38,11 @@ import org.hibernate.internal.CoreMessageLogger;
|
|||
public abstract class FromReferenceNode extends AbstractSelectExpression
|
||||
implements ResolvableNode, DisplayableNode, InitializeableNode, PathNode {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, FromReferenceNode.class.getName() );
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( FromReferenceNode.class );
|
||||
|
||||
private FromElement fromElement;
|
||||
private boolean resolved = false;
|
||||
private boolean resolved;
|
||||
|
||||
public static final int ROOT_LEVEL = 0;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -49,10 +49,11 @@ import org.hibernate.type.Type;
|
|||
* @author josh
|
||||
*/
|
||||
public class IdentNode extends FromReferenceNode implements SelectExpression {
|
||||
|
||||
private static final int UNKNOWN = 0;
|
||||
private static final int PROPERTY_REF = 1;
|
||||
private static final int COMPONENT_REF = 2;
|
||||
private static enum DereferenceType {
|
||||
UNKNOWN,
|
||||
PROPERTY_REF,
|
||||
COMPONENT_REF
|
||||
}
|
||||
|
||||
private boolean nakedPropertyRef = false;
|
||||
|
||||
|
@ -120,12 +121,12 @@ public class IdentNode extends FromReferenceNode implements SelectExpression {
|
|||
}
|
||||
}
|
||||
else {
|
||||
int result = resolveAsNakedPropertyRef();
|
||||
if (result == PROPERTY_REF) {
|
||||
DereferenceType result = resolveAsNakedPropertyRef();
|
||||
if (result == DereferenceType.PROPERTY_REF) {
|
||||
// we represent a naked (simple) prop-ref
|
||||
setResolved();
|
||||
}
|
||||
else if (result == COMPONENT_REF) {
|
||||
else if (result == DereferenceType.COMPONENT_REF) {
|
||||
// EARLY EXIT!!! return so the resolve call explicitly coming from DotNode can
|
||||
// resolve this...
|
||||
return;
|
||||
|
@ -210,28 +211,28 @@ public class IdentNode extends FromReferenceNode implements SelectExpression {
|
|||
try {
|
||||
propertyType = fromElement.getPropertyType(property, property);
|
||||
}
|
||||
catch (Throwable t) {
|
||||
catch (Throwable ignore) {
|
||||
}
|
||||
return propertyType;
|
||||
}
|
||||
|
||||
private int resolveAsNakedPropertyRef() {
|
||||
private DereferenceType resolveAsNakedPropertyRef() {
|
||||
FromElement fromElement = locateSingleFromElement();
|
||||
if (fromElement == null) {
|
||||
return UNKNOWN;
|
||||
return DereferenceType.UNKNOWN;
|
||||
}
|
||||
Queryable persister = fromElement.getQueryable();
|
||||
if (persister == null) {
|
||||
return UNKNOWN;
|
||||
return DereferenceType.UNKNOWN;
|
||||
}
|
||||
Type propertyType = getNakedPropertyType(fromElement);
|
||||
if (propertyType == null) {
|
||||
// assume this ident's text does *not* refer to a property on the given persister
|
||||
return UNKNOWN;
|
||||
return DereferenceType.UNKNOWN;
|
||||
}
|
||||
|
||||
if ((propertyType.isComponentType() || propertyType.isAssociationType() )) {
|
||||
return COMPONENT_REF;
|
||||
return DereferenceType.COMPONENT_REF;
|
||||
}
|
||||
|
||||
setFromElement(fromElement);
|
||||
|
@ -247,7 +248,7 @@ public class IdentNode extends FromReferenceNode implements SelectExpression {
|
|||
super.setDataType(propertyType);
|
||||
nakedPropertyRef = true;
|
||||
|
||||
return PROPERTY_REF;
|
||||
return DereferenceType.PROPERTY_REF;
|
||||
}
|
||||
|
||||
private boolean resolveAsNakedComponentPropertyRefLHS(DotNode parent) {
|
||||
|
@ -264,7 +265,7 @@ public class IdentNode extends FromReferenceNode implements SelectExpression {
|
|||
throw new QueryException("Property '" + getOriginalText() + "' is not a component. Use an alias to reference associations or collections.");
|
||||
}
|
||||
|
||||
Type propertyType = null; // used to set the type of the parent dot node
|
||||
Type propertyType;
|
||||
String propertyPath = getText() + "." + getNextSibling().getText();
|
||||
try {
|
||||
// check to see if our "propPath" actually
|
||||
|
@ -289,7 +290,7 @@ public class IdentNode extends FromReferenceNode implements SelectExpression {
|
|||
return false;
|
||||
}
|
||||
|
||||
Type propertyType = null;
|
||||
Type propertyType;
|
||||
String propertyPath = parent.getLhs().getText() + "." + getText();
|
||||
try {
|
||||
// check to see if our "propPath" actually
|
||||
|
@ -373,7 +374,7 @@ public class IdentNode extends FromReferenceNode implements SelectExpression {
|
|||
buf.append("}");
|
||||
}
|
||||
else {
|
||||
buf.append("{originalText=" + getOriginalText()).append("}");
|
||||
buf.append( "{originalText=" ).append( getOriginalText() ).append( "}" );
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2013, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,11 +20,9 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.hql.internal.ast.tree;
|
||||
|
||||
|
||||
/**
|
||||
* Represents a FROM element implied by a path expression or a collection reference.
|
||||
*
|
||||
|
@ -35,12 +33,12 @@ public class ImpliedFromElement extends FromElement {
|
|||
* True if this from element was implied from a path in the FROM clause, but not
|
||||
* explicitly declard in the from clause.
|
||||
*/
|
||||
private boolean impliedInFromClause = false;
|
||||
private boolean impliedInFromClause;
|
||||
|
||||
/**
|
||||
* True if this implied from element should be included in the projection list.
|
||||
*/
|
||||
private boolean inProjectionList = false;
|
||||
private boolean inProjectionList;
|
||||
|
||||
public boolean isImplied() {
|
||||
return true;
|
||||
|
|
|
@ -51,7 +51,7 @@ import org.hibernate.type.Type;
|
|||
public class MapEntryNode extends AbstractMapComponentNode implements AggregatedSelectExpression {
|
||||
private static class LocalAliasGenerator implements AliasGenerator {
|
||||
private final int base;
|
||||
private int counter = 0;
|
||||
private int counter;
|
||||
|
||||
private LocalAliasGenerator(int base) {
|
||||
this.base = base;
|
||||
|
|
|
@ -43,8 +43,7 @@ import antlr.collections.AST;
|
|||
* @author josh
|
||||
*/
|
||||
public class SelectClause extends SelectExpressionList {
|
||||
|
||||
private boolean prepared = false;
|
||||
private boolean prepared;
|
||||
private boolean scalarSelect;
|
||||
|
||||
private List fromElementsForLoad = new ArrayList();
|
||||
|
@ -338,7 +337,7 @@ public class SelectClause extends SelectExpressionList {
|
|||
finishInitialization( queryReturnTypeList );
|
||||
}
|
||||
|
||||
public static boolean VERSION2_SQL = false;
|
||||
public static boolean VERSION2_SQL;
|
||||
|
||||
private void addCollectionFromElement(FromElement fromElement) {
|
||||
if ( fromElement.isFetch() ) {
|
||||
|
|
|
@ -33,7 +33,7 @@ import org.hibernate.internal.util.StringHelper;
|
|||
* generated aliases are unique.
|
||||
*/
|
||||
public class AliasGenerator {
|
||||
private int next = 0;
|
||||
private int next;
|
||||
|
||||
private int nextCount() {
|
||||
return next++;
|
||||
|
|
|
@ -51,7 +51,7 @@ public final class ColumnHelper {
|
|||
/**
|
||||
* Generates the scalar column AST nodes for a given array of SQL columns
|
||||
*/
|
||||
public static void generateScalarColumns(HqlSqlWalkerNode node, String sqlColumns[], int i) {
|
||||
public static void generateScalarColumns(HqlSqlWalkerNode node, String[] sqlColumns, int i) {
|
||||
if ( sqlColumns.length == 1 ) {
|
||||
generateSingleScalarColumn( node, i );
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2013, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,11 +20,10 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.hql.internal.classic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.hibernate.QueryException;
|
||||
|
@ -33,13 +32,13 @@ import org.hibernate.QueryException;
|
|||
* Parses the Hibernate query into its constituent clauses.
|
||||
*/
|
||||
public class ClauseParser implements Parser {
|
||||
|
||||
private Parser child;
|
||||
private List selectTokens;
|
||||
private boolean cacheSelectTokens = false;
|
||||
private boolean byExpected = false;
|
||||
private int parenCount = 0;
|
||||
private List<String> selectTokens;
|
||||
private boolean cacheSelectTokens;
|
||||
private boolean byExpected;
|
||||
private int parenCount;
|
||||
|
||||
@Override
|
||||
public void token(String token, QueryTranslatorImpl q) throws QueryException {
|
||||
String lcToken = token.toLowerCase();
|
||||
|
||||
|
@ -58,7 +57,7 @@ public class ClauseParser implements Parser {
|
|||
|
||||
if ( isClauseStart ) {
|
||||
if ( lcToken.equals( "select" ) ) {
|
||||
selectTokens = new ArrayList();
|
||||
selectTokens = new ArrayList<String>();
|
||||
cacheSelectTokens = true;
|
||||
}
|
||||
else if ( lcToken.equals( "from" ) ) {
|
||||
|
@ -122,17 +121,18 @@ public class ClauseParser implements Parser {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(QueryTranslatorImpl q) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void end(QueryTranslatorImpl q) throws QueryException {
|
||||
endChild( q );
|
||||
if ( selectTokens != null ) {
|
||||
child = new SelectParser();
|
||||
child.start( q );
|
||||
Iterator iter = selectTokens.iterator();
|
||||
while ( iter.hasNext() ) {
|
||||
token( ( String ) iter.next(), q );
|
||||
for ( String selectToken : selectTokens ) {
|
||||
token( selectToken, q );
|
||||
}
|
||||
child.end( q );
|
||||
}
|
||||
|
@ -142,10 +142,3 @@ public class ClauseParser implements Parser {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ import org.hibernate.hql.internal.HolderInstantiator;
|
|||
import org.hibernate.hql.internal.NameGenerator;
|
||||
import org.hibernate.hql.spi.FilterTranslator;
|
||||
import org.hibernate.hql.spi.ParameterTranslations;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.IteratorImpl;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
|
@ -83,8 +84,7 @@ import org.hibernate.type.Type;
|
|||
* query string to SQL.
|
||||
*/
|
||||
public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, QueryTranslatorImpl.class.getName());
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( QueryTranslatorImpl.class );
|
||||
|
||||
private static final String[] NO_RETURN_ALIASES = new String[] {};
|
||||
|
||||
|
@ -124,9 +124,9 @@ public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator
|
|||
private Type[] actualReturnTypes;
|
||||
private String[][] scalarColumnNames;
|
||||
private Map tokenReplacements;
|
||||
private int nameCount = 0;
|
||||
private int parameterCount = 0;
|
||||
private boolean distinct = false;
|
||||
private int nameCount;
|
||||
private int parameterCount;
|
||||
private boolean distinct;
|
||||
private boolean compiled;
|
||||
private String sqlString;
|
||||
private Class holderClass;
|
||||
|
|
|
@ -173,15 +173,15 @@ public class WhereParser implements Parser {
|
|||
// foo.Bar.Baz + a.B.C (maps to: bar.Baz + b.C and foo.Bar = bar.id and a.B = b.id)
|
||||
// ( foo.Bar.Baz + 1.0 ) < 2.0 (maps to: ( bar.Baz + 1.0 ) < 2.0 and foo.Bar = bar.id)
|
||||
|
||||
private boolean betweenSpecialCase = false; //Inside a BETWEEN ... AND ... expression
|
||||
private boolean negated = false;
|
||||
private boolean betweenSpecialCase; //Inside a BETWEEN ... AND ... expression
|
||||
private boolean negated;
|
||||
|
||||
private boolean inSubselect = false;
|
||||
private int bracketsSinceSelect = 0;
|
||||
private boolean inSubselect;
|
||||
private int bracketsSinceSelect;
|
||||
private StringBuilder subselect;
|
||||
|
||||
private boolean expectingPathContinuation = false;
|
||||
private int expectingIndex = 0;
|
||||
private boolean expectingPathContinuation;
|
||||
private int expectingIndex;
|
||||
|
||||
// The following variables are stacks that keep information about each subexpression
|
||||
// in the list of nested subexpressions we are currently processing.
|
||||
|
|
|
@ -48,7 +48,7 @@ import org.hibernate.sql.SelectValues;
|
|||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class AbstractTableBasedBulkIdHandler {
|
||||
public abstract class AbstractTableBasedBulkIdHandler {
|
||||
private final SessionFactoryImplementor sessionFactory;
|
||||
private final HqlSqlWalker walker;
|
||||
|
||||
|
|
|
@ -22,15 +22,15 @@
|
|||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.id;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
|
||||
/**
|
||||
|
@ -39,20 +39,18 @@ import org.hibernate.internal.CoreMessageLogger;
|
|||
* @author Joseph Fifield
|
||||
*/
|
||||
public class GUIDGenerator implements IdentifierGenerator {
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( GUIDGenerator.class );
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, GUIDGenerator.class.getName());
|
||||
private static boolean warned = false;
|
||||
private static boolean WARNED;
|
||||
|
||||
public GUIDGenerator() {
|
||||
if ( ! warned ) {
|
||||
warned = true;
|
||||
LOG.deprecatedUuidGenerator(UUIDGenerator.class.getName(), UUIDGenerationStrategy.class.getName());
|
||||
if ( !WARNED ) {
|
||||
WARNED = true;
|
||||
LOG.deprecatedUuidGenerator( UUIDGenerator.class.getName(), UUIDGenerationStrategy.class.getName() );
|
||||
}
|
||||
}
|
||||
|
||||
public Serializable generate(SessionImplementor session, Object obj)
|
||||
throws HibernateException {
|
||||
|
||||
public Serializable generate(SessionImplementor session, Object obj) throws HibernateException {
|
||||
final String sql = session.getFactory().getDialect().getSelectGUIDString();
|
||||
try {
|
||||
PreparedStatement st = session.getTransactionCoordinator().getJdbcCoordinator().getStatementPreparer().prepareStatement( sql );
|
||||
|
|
|
@ -46,38 +46,31 @@ import org.hibernate.type.Type;
|
|||
* @author Gavin King
|
||||
*/
|
||||
public class UUIDHexGenerator extends AbstractUUIDGenerator implements Configurable {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, UUIDHexGenerator.class.getName());
|
||||
|
||||
private static boolean warned = false;
|
||||
private static boolean WARNED;
|
||||
|
||||
private String sep = "";
|
||||
|
||||
public UUIDHexGenerator() {
|
||||
if ( ! warned ) {
|
||||
warned = true;
|
||||
LOG.usingUuidHexGenerator(this.getClass().getName(), UUIDGenerator.class.getName());
|
||||
if ( !WARNED ) {
|
||||
WARNED = true;
|
||||
LOG.usingUuidHexGenerator( this.getClass().getName(), UUIDGenerator.class.getName() );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void configure(Type type, Properties params, Dialect d) {
|
||||
sep = ConfigurationHelper.getString( "separator", params, "" );
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Serializable generate(SessionImplementor session, Object obj) {
|
||||
return new StringBuilder( 36 )
|
||||
.append( format( getIP() ) ).append( sep )
|
||||
.append( format( getJVM() ) ).append( sep )
|
||||
.append( format( getHiTime() ) ).append( sep )
|
||||
.append( format( getLoTime() ) ).append( sep )
|
||||
.append( format( getCount() ) )
|
||||
.toString();
|
||||
return format( getIP() ) + sep
|
||||
+ format( getJVM() ) + sep
|
||||
+ format( getHiTime() ) + sep
|
||||
+ format( getLoTime() ) + sep
|
||||
+ format( getCount() );
|
||||
}
|
||||
|
||||
protected String format(int intValue) {
|
||||
|
|
|
@ -33,7 +33,9 @@ import org.hibernate.internal.util.BytesHelper;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class Helper {
|
||||
public final class Helper {
|
||||
private Helper() {
|
||||
}
|
||||
|
||||
// IP ADDRESS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ public final class SessionFactoryImpl
|
|||
private final transient ConcurrentHashMap<EntityNameResolver,Object> entityNameResolvers = new ConcurrentHashMap<EntityNameResolver, Object>();
|
||||
private final transient QueryPlanCache queryPlanCache;
|
||||
private final transient CacheImplementor cacheAccess;
|
||||
private transient boolean isClosed = false;
|
||||
private transient boolean isClosed;
|
||||
private final transient TypeResolver typeResolver;
|
||||
private final transient TypeHelper typeHelper;
|
||||
private final transient TransactionEnvironment transactionEnvironment;
|
||||
|
|
|
@ -181,7 +181,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
|||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, SessionImpl.class.getName());
|
||||
|
||||
private static final boolean tracing = LOG.isTraceEnabled();
|
||||
private static final boolean TRACE_ENABLED = LOG.isTraceEnabled();
|
||||
|
||||
private transient long timestamp;
|
||||
|
||||
|
@ -202,7 +202,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
|||
private transient boolean flushBeforeCompletionEnabled;
|
||||
private transient boolean autoCloseSessionEnabled;
|
||||
|
||||
private transient int dontFlushFromFind = 0;
|
||||
private transient int dontFlushFromFind;
|
||||
|
||||
private transient LoadQueryInfluencers loadQueryInfluencers;
|
||||
|
||||
|
@ -314,7 +314,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
|||
factory.getStatisticsImplementor().openSession();
|
||||
}
|
||||
|
||||
if (tracing)
|
||||
if ( TRACE_ENABLED )
|
||||
LOG.tracef( "Opened session at timestamp: %s", timestamp );
|
||||
}
|
||||
|
||||
|
|
|
@ -27,9 +27,11 @@ package org.hibernate.internal.util;
|
|||
*
|
||||
* @author Brett Meyer
|
||||
*/
|
||||
public class ClassLoaderHelper {
|
||||
|
||||
public static ClassLoader overridenClassLoader = null;
|
||||
public final class ClassLoaderHelper {
|
||||
private ClassLoaderHelper() {
|
||||
}
|
||||
|
||||
public static ClassLoader overridenClassLoader;
|
||||
|
||||
public static ClassLoader getContextClassLoader() {
|
||||
return overridenClassLoader != null ?
|
||||
|
|
|
@ -5,7 +5,10 @@ import java.sql.SQLException;
|
|||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class JdbcExceptionHelper {
|
||||
public final class JdbcExceptionHelper {
|
||||
private JdbcExceptionHelper() {
|
||||
}
|
||||
|
||||
/**
|
||||
* For the given SQLException, locates the vendor-specific error code.
|
||||
*
|
||||
|
|
|
@ -34,7 +34,10 @@ import org.hibernate.LockMode;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class LockModeConverter {
|
||||
public final class LockModeConverter {
|
||||
private LockModeConverter() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert from the Hibernate specific LockMode to the JPA defined LockModeType.
|
||||
*
|
||||
|
|
|
@ -124,7 +124,7 @@ public final class StringHelper {
|
|||
return replace( template, placeholder, replacement, false );
|
||||
}
|
||||
|
||||
public static String[] replace(String templates[], String placeholder, String replacement) {
|
||||
public static String[] replace(String[] templates, String placeholder, String replacement) {
|
||||
String[] result = new String[templates.length];
|
||||
for ( int i =0; i<templates.length; i++ ) {
|
||||
result[i] = replace( templates[i], placeholder, replacement );
|
||||
|
|
|
@ -993,7 +993,7 @@ public class BoundedConcurrentHashMap<K, V> extends AbstractMap<K, V>
|
|||
private final int maximumSize ;
|
||||
|
||||
/** The actual number of hot entries. */
|
||||
private int hotSize = 0;
|
||||
private int hotSize;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -37,11 +37,10 @@ import java.util.Set;
|
|||
* rather than <tt>equals()</tt>.
|
||||
*/
|
||||
public final class IdentityMap<K,V> implements Map<K,V> {
|
||||
|
||||
private final Map<IdentityKey<K>,V> map;
|
||||
@SuppressWarnings( {"unchecked"})
|
||||
private transient Entry<IdentityKey<K>,V>[] entryArray = new Entry[0];
|
||||
private transient boolean dirty = false;
|
||||
private transient boolean dirty;
|
||||
|
||||
/**
|
||||
* Return a new instance of this class, with iteration
|
||||
|
@ -226,7 +225,7 @@ public final class IdentityMap<K,V> implements Map<K,V> {
|
|||
public static final class IdentityKey<K> implements Serializable {
|
||||
|
||||
private final K key;
|
||||
private int hash = 0;
|
||||
private int hash;
|
||||
|
||||
IdentityKey(K key) {
|
||||
this.key = key;
|
||||
|
|
|
@ -34,7 +34,10 @@ import org.hibernate.HibernateException;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class StreamCopier {
|
||||
public final class StreamCopier {
|
||||
private StreamCopier() {
|
||||
}
|
||||
|
||||
public static final int BUFFER_SIZE = 1024 * 4;
|
||||
public static final byte[] BUFFER = new byte[ BUFFER_SIZE ];
|
||||
|
||||
|
|
|
@ -28,7 +28,10 @@ package org.hibernate.internal.util.type;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class PrimitiveWrapperHelper {
|
||||
public final class PrimitiveWrapperHelper {
|
||||
private PrimitiveWrapperHelper() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Describes a particular primitive/wrapper combo
|
||||
*/
|
||||
|
|
|
@ -42,8 +42,8 @@ import javax.xml.stream.events.XMLEvent;
|
|||
*/
|
||||
public class BufferedXMLEventReader extends BaseXMLEventReader {
|
||||
private final LinkedList<XMLEvent> eventBuffer = new LinkedList<XMLEvent>();
|
||||
private int eventLimit = 0;
|
||||
private ListIterator<XMLEvent> bufferReader = null;
|
||||
private int eventLimit;
|
||||
private ListIterator<XMLEvent> bufferReader;
|
||||
|
||||
/**
|
||||
* Create new buffering reader, no buffering is done until {@link #mark(int)} is called.
|
||||
|
|
|
@ -46,7 +46,7 @@ import javax.xml.stream.events.XMLEvent;
|
|||
*/
|
||||
public abstract class FilteringXMLEventReader extends BaseXMLEventReader {
|
||||
private final Deque<QName> prunedElements = new LinkedList<QName>();
|
||||
private XMLEvent peekedEvent = null;
|
||||
private XMLEvent peekedEvent;
|
||||
|
||||
public FilteringXMLEventReader(XMLEventReader reader) {
|
||||
super(reader);
|
||||
|
|
|
@ -35,7 +35,10 @@ import javax.xml.stream.XMLStreamConstants;
|
|||
*
|
||||
* @author Eric Dalquist
|
||||
*/
|
||||
public class XMLStreamConstantsUtils {
|
||||
public final class XMLStreamConstantsUtils {
|
||||
private XMLStreamConstantsUtils() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the human readable event name for the numeric event id
|
||||
*/
|
||||
|
|
|
@ -51,7 +51,7 @@ public class SQLQueryParser {
|
|||
private final ParserContext context;
|
||||
|
||||
private final Map namedParameters = new HashMap();
|
||||
private long aliasesFound = 0;
|
||||
private long aliasesFound;
|
||||
|
||||
static interface ParserContext {
|
||||
boolean isEntityAlias(String aliasName);
|
||||
|
@ -297,25 +297,30 @@ public class SQLQueryParser {
|
|||
public static class ParameterSubstitutionRecognizer implements ParameterParser.Recognizer {
|
||||
StringBuilder result = new StringBuilder();
|
||||
Map namedParameterBindPoints = new HashMap();
|
||||
int parameterCount = 0;
|
||||
int parameterCount;
|
||||
|
||||
@Override
|
||||
public void outParameter(int position) {
|
||||
result.append( '?' );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ordinalParameter(int position) {
|
||||
result.append( '?' );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void namedParameter(String name, int position) {
|
||||
addNamedParameter( name );
|
||||
result.append( '?' );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jpaPositionalParameter(String name, int position) {
|
||||
namedParameter( name, position );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void other(char character) {
|
||||
result.append( character );
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ import org.hibernate.engine.query.spi.sql.NativeSQLQueryReturn;
|
|||
import org.hibernate.engine.query.spi.sql.NativeSQLQueryRootReturn;
|
||||
import org.hibernate.engine.query.spi.sql.NativeSQLQueryScalarReturn;
|
||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.loader.BasicLoader;
|
||||
import org.hibernate.loader.CollectionAliases;
|
||||
|
@ -81,9 +82,7 @@ import org.hibernate.type.Type;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class SQLQueryReturnProcessor {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
||||
SQLQueryReturnProcessor.class.getName());
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( SQLQueryReturnProcessor.class );
|
||||
|
||||
private NativeSQLQueryReturn[] queryReturns;
|
||||
|
||||
|
@ -111,8 +110,8 @@ public class SQLQueryReturnProcessor {
|
|||
// private List collectionPersisters = new ArrayList();
|
||||
// private List collectionResults = new ArrayList();
|
||||
|
||||
private int entitySuffixSeed = 0;
|
||||
private int collectionSuffixSeed = 0;
|
||||
private int entitySuffixSeed;
|
||||
private int collectionSuffixSeed;
|
||||
|
||||
|
||||
public SQLQueryReturnProcessor(NativeSQLQueryReturn[] queryReturns, SessionFactoryImplementor factory) {
|
||||
|
|
|
@ -152,4 +152,4 @@ public class EntityLoader extends AbstractLoadPlanBasedEntityLoader {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,9 +77,9 @@ public class QuerySpacesImpl implements ExpandingQuerySpaces {
|
|||
return space;
|
||||
}
|
||||
|
||||
// ExpandingQuerySpaces impl ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// ExpandingQuerySpaces impl ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
private int implicitUidBase = 0;
|
||||
private int implicitUidBase;
|
||||
|
||||
@Override
|
||||
public String generateImplicitUid() {
|
||||
|
|
|
@ -29,4 +29,4 @@ import org.hibernate.loader.plan.spi.CollectionQuerySpace;
|
|||
* @author Gail Badner
|
||||
*/
|
||||
public interface ExpandingCollectionQuerySpace extends CollectionQuerySpace, ExpandingQuerySpace {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,10 @@ import org.hibernate.persister.walking.spi.MetamodelGraphWalker;
|
|||
*
|
||||
* @see org.hibernate.persister.walking.spi.MetamodelGraphWalker
|
||||
*/
|
||||
public class MetamodelDrivenLoadPlanBuilder {
|
||||
public final class MetamodelDrivenLoadPlanBuilder {
|
||||
private MetamodelDrivenLoadPlanBuilder() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Coordinates building a LoadPlan that defines just a single root entity return (may have fetches).
|
||||
* <p/>
|
||||
|
|
|
@ -35,4 +35,4 @@ public interface CollectionFetchableIndex extends FetchSource {
|
|||
* @return the collection reference.
|
||||
*/
|
||||
public CollectionReference getCollectionReference();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,13 +46,13 @@ public class Column implements Selectable, Serializable, Cloneable {
|
|||
private int precision=DEFAULT_PRECISION;
|
||||
private int scale=DEFAULT_SCALE;
|
||||
private Value value;
|
||||
private int typeIndex = 0;
|
||||
private int typeIndex;
|
||||
private String name;
|
||||
private boolean nullable=true;
|
||||
private boolean unique=false;
|
||||
private boolean unique;
|
||||
private String sqlType;
|
||||
private Integer sqlTypeCode;
|
||||
private boolean quoted=false;
|
||||
private boolean quoted;
|
||||
int uniqueInteger;
|
||||
private String checkConstraint;
|
||||
private String comment;
|
||||
|
@ -139,6 +139,7 @@ public class Column implements Selectable, Serializable, Cloneable {
|
|||
/**
|
||||
* Generate a column alias that is unique across multiple tables
|
||||
*/
|
||||
@Override
|
||||
public String getAlias(Dialect dialect, Table table) {
|
||||
return getAlias(dialect) + table.getUniqueInteger() + '_';
|
||||
}
|
||||
|
@ -162,13 +163,15 @@ public class Column implements Selectable, Serializable, Cloneable {
|
|||
return unique;
|
||||
}
|
||||
|
||||
//used also for generation of FK names!
|
||||
@Override
|
||||
public int hashCode() {
|
||||
//used also for generation of FK names!
|
||||
return isQuoted() ?
|
||||
name.hashCode() :
|
||||
name.toLowerCase().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
return object instanceof Column && equals( (Column) object );
|
||||
}
|
||||
|
@ -244,6 +247,7 @@ public class Column implements Selectable, Serializable, Cloneable {
|
|||
return quoted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getName() + '(' + getName() + ')';
|
||||
}
|
||||
|
@ -260,6 +264,7 @@ public class Column implements Selectable, Serializable, Cloneable {
|
|||
return checkConstraint!=null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTemplate(Dialect dialect, SQLFunctionRegistry functionRegistry) {
|
||||
return hasCustomRead()
|
||||
? Template.renderWhereStringTemplate( customRead, dialect, functionRegistry )
|
||||
|
@ -277,14 +282,18 @@ public class Column implements Selectable, Serializable, Cloneable {
|
|||
public String getWriteExpr() {
|
||||
return ( customWrite != null && customWrite.length() > 0 ) ? customWrite : "?";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isFormula() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Dialect d) {
|
||||
return getQuotedName(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return getName();
|
||||
}
|
||||
|
|
|
@ -42,31 +42,45 @@ public class Formula implements Selectable, Serializable {
|
|||
uniqueInteger = formulaUniqueInteger++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTemplate(Dialect dialect, SQLFunctionRegistry functionRegistry) {
|
||||
return Template.renderWhereStringTemplate(formula, dialect, functionRegistry);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText(Dialect dialect) {
|
||||
return getFormula();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return getFormula();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlias(Dialect dialect) {
|
||||
return "formula" + Integer.toString(uniqueInteger) + '_';
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAlias(Dialect dialect, Table table) {
|
||||
return getAlias(dialect);
|
||||
}
|
||||
|
||||
public String getFormula() {
|
||||
return formula;
|
||||
}
|
||||
|
||||
public void setFormula(String string) {
|
||||
formula = string;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFormula() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.getClass().getName() + "( " + formula + " )";
|
||||
}
|
||||
|
|
|
@ -48,24 +48,24 @@ public class RootClass extends PersistentClass implements TableOwner {
|
|||
public static final String DEFAULT_IDENTIFIER_COLUMN_NAME = "id";
|
||||
public static final String DEFAULT_DISCRIMINATOR_COLUMN_NAME = "class";
|
||||
|
||||
private Property identifierProperty; //may be final
|
||||
private KeyValue identifier; //may be final
|
||||
private Property version; //may be final
|
||||
private Property identifierProperty;
|
||||
private KeyValue identifier;
|
||||
private Property version;
|
||||
private boolean polymorphic;
|
||||
private String cacheConcurrencyStrategy;
|
||||
private String cacheRegionName;
|
||||
private String naturalIdCacheRegionName;
|
||||
private boolean lazyPropertiesCacheable = true;
|
||||
private Value discriminator; //may be final
|
||||
private Value discriminator;
|
||||
private boolean mutable = true;
|
||||
private boolean embeddedIdentifier = false; // may be final
|
||||
private boolean embeddedIdentifier;
|
||||
private boolean explicitPolymorphism;
|
||||
private Class entityPersisterClass;
|
||||
private boolean forceDiscriminator = false;
|
||||
private boolean forceDiscriminator;
|
||||
private String where;
|
||||
private Table table;
|
||||
private boolean discriminatorInsertable = true;
|
||||
private int nextSubclassId = 0;
|
||||
private int nextSubclassId;
|
||||
private Property declaredIdentifierProperty;
|
||||
private Property declaredVersion;
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public class Table implements RelationalModel, Serializable {
|
|||
private String rowId;
|
||||
private String subselect;
|
||||
private boolean isAbstract;
|
||||
private boolean hasDenormalizedTables = false;
|
||||
private boolean hasDenormalizedTables;
|
||||
private String comment;
|
||||
|
||||
static class ForeignKeyKey implements Serializable {
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.mapping;
|
||||
import java.util.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.dialect.Dialect;
|
||||
|
|
|
@ -1784,13 +1784,13 @@ public abstract class AbstractCollectionPersister
|
|||
}
|
||||
|
||||
public String[] getCollectionPropertyColumnAliases(String propertyName, String suffix) {
|
||||
String rawAliases[] = (String[]) collectionPropertyColumnAliases.get( propertyName );
|
||||
String[] rawAliases = (String[]) collectionPropertyColumnAliases.get( propertyName );
|
||||
|
||||
if ( rawAliases == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String result[] = new String[rawAliases.length];
|
||||
String[] result = new String[rawAliases.length];
|
||||
for ( int i = 0; i < rawAliases.length; i++ ) {
|
||||
result[i] = new Alias( suffix ).toUnquotedAliasString( rawAliases[i] );
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2008, Red Hat Middleware LLC or third-party contributors as
|
||||
* Copyright (c) 2013, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Middleware LLC.
|
||||
* distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
|
@ -20,17 +20,17 @@
|
|||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
package org.hibernate.persister.collection;
|
||||
|
||||
|
||||
/**
|
||||
* The names of all the collection properties.
|
||||
*
|
||||
* @author josh
|
||||
*/
|
||||
public class CollectionPropertyNames {
|
||||
public final class CollectionPropertyNames {
|
||||
private CollectionPropertyNames() {
|
||||
}
|
||||
|
||||
public static final String COLLECTION_SIZE = "size";
|
||||
public static final String COLLECTION_ELEMENTS = "elements";
|
||||
|
|
|
@ -2195,13 +2195,13 @@ public abstract class AbstractEntityPersister
|
|||
}
|
||||
|
||||
public String[] getSubclassPropertyColumnAliases(String propertyName, String suffix) {
|
||||
String rawAliases[] = ( String[] ) subclassPropertyAliases.get( propertyName );
|
||||
String[] rawAliases = ( String[] ) subclassPropertyAliases.get( propertyName );
|
||||
|
||||
if ( rawAliases == null ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String result[] = new String[rawAliases.length];
|
||||
String[] result = new String[rawAliases.length];
|
||||
for ( int i = 0; i < rawAliases.length; i++ ) {
|
||||
result[i] = new Alias( suffix ).toUnquotedAliasString( rawAliases[i] );
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ package org.hibernate.persister.walking.internal;
|
|||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.engine.FetchStrategy;
|
||||
import org.hibernate.engine.FetchStyle;
|
||||
import org.hibernate.engine.FetchTiming;
|
||||
|
@ -63,7 +62,9 @@ import org.hibernate.type.Type;
|
|||
*
|
||||
* @author Gail Badner
|
||||
*/
|
||||
public class CompositionSingularSubAttributesHelper {
|
||||
public final class CompositionSingularSubAttributesHelper {
|
||||
private CompositionSingularSubAttributesHelper() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get composite ID sub-attribute definitions.
|
||||
|
@ -123,8 +124,8 @@ public class CompositionSingularSubAttributesHelper {
|
|||
public Iterator<AttributeDefinition> iterator() {
|
||||
return new Iterator<AttributeDefinition>() {
|
||||
private final int numberOfAttributes = compositeType.getSubtypes().length;
|
||||
private int currentSubAttributeNumber = 0;
|
||||
private int currentColumnPosition = 0;
|
||||
private int currentSubAttributeNumber;
|
||||
private int currentColumnPosition;
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
|
|
|
@ -37,7 +37,9 @@ import org.hibernate.type.Type;
|
|||
/**
|
||||
* @author Gail Badner
|
||||
*/
|
||||
public class EntityIdentifierDefinitionHelper {
|
||||
public final class EntityIdentifierDefinitionHelper {
|
||||
private EntityIdentifierDefinitionHelper() {
|
||||
}
|
||||
|
||||
public static EntityIdentifierDefinition buildSimpleEncapsulatedIdentifierDefinition(final AbstractEntityPersister entityPersister) {
|
||||
return new EncapsulatedEntityIdentifierDefinition() {
|
||||
|
|
|
@ -37,12 +37,14 @@ import org.hibernate.persister.collection.CollectionPersister;
|
|||
import org.hibernate.persister.entity.EntityPersister;
|
||||
import org.hibernate.persister.entity.OuterJoinLoadable;
|
||||
import org.hibernate.type.AssociationType;
|
||||
import org.hibernate.type.EntityType;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class FetchStrategyHelper {
|
||||
public final class FetchStrategyHelper {
|
||||
private FetchStrategyHelper() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the fetch-style (if one) explicitly set for this association via fetch profiles.
|
||||
* <p/>
|
||||
|
|
|
@ -59,7 +59,7 @@ public abstract class AbstractLazyInitializer implements LazyInitializer {
|
|||
private Boolean readOnlyBeforeAttachedToSession;
|
||||
|
||||
private String sessionFactoryUuid;
|
||||
private boolean specjLazyLoad = false;
|
||||
private boolean specjLazyLoad;
|
||||
|
||||
/**
|
||||
* For serialization from the non-pojo initializers (HHH-3309)
|
||||
|
|
|
@ -35,6 +35,7 @@ import org.jboss.logging.Logger;
|
|||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.engine.spi.SessionImplementor;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.ReflectHelper;
|
||||
import org.hibernate.proxy.HibernateProxy;
|
||||
|
@ -47,8 +48,7 @@ import org.hibernate.type.CompositeType;
|
|||
* @author Muga Nishizawa
|
||||
*/
|
||||
public class JavassistLazyInitializer extends BasicLazyInitializer implements MethodHandler {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, JavassistLazyInitializer.class.getName());
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( JavassistLazyInitializer.class );
|
||||
|
||||
private static final MethodFilter FINALIZE_FILTER = new MethodFilter() {
|
||||
public boolean isHandled(Method m) {
|
||||
|
@ -58,7 +58,7 @@ public class JavassistLazyInitializer extends BasicLazyInitializer implements Me
|
|||
};
|
||||
|
||||
private Class[] interfaces;
|
||||
private boolean constructed = false;
|
||||
private boolean constructed;
|
||||
|
||||
private JavassistLazyInitializer(
|
||||
final String entityName,
|
||||
|
|
|
@ -53,7 +53,10 @@ import org.hibernate.tool.hbm2ddl.ImportSqlCommandExtractorInitiator;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class StandardServiceInitiators {
|
||||
public final class StandardServiceInitiators {
|
||||
private StandardServiceInitiators() {
|
||||
}
|
||||
|
||||
public static List<StandardServiceInitiator> LIST = buildStandardServiceInitiatorList();
|
||||
|
||||
private static List<StandardServiceInitiator> buildStandardServiceInitiatorList() {
|
||||
|
|
|
@ -41,7 +41,7 @@ public class QuerySelect {
|
|||
private StringBuilder orderBy = new StringBuilder();
|
||||
private StringBuilder having = new StringBuilder();
|
||||
private String comment;
|
||||
private boolean distinct=false;
|
||||
private boolean distinct;
|
||||
|
||||
private static final HashSet DONT_SPACE_TOKENS = new HashSet();
|
||||
static {
|
||||
|
|
|
@ -127,7 +127,7 @@ public class SelectFragment {
|
|||
return addFormula( tableAlias, columnTemplate, columnAlias );
|
||||
}
|
||||
|
||||
public SelectFragment addColumnTemplates(String tableAlias, String[] columnTemplates, String columnAliases[]) {
|
||||
public SelectFragment addColumnTemplates(String tableAlias, String[] columnTemplates, String[] columnAliases) {
|
||||
// In this context, there's no difference between a column template and a formula.
|
||||
return addFormulas( tableAlias, columnTemplates, columnAliases );
|
||||
}
|
||||
|
|
|
@ -102,9 +102,9 @@ public class SchemaExport {
|
|||
private Formatter formatter;
|
||||
private ImportSqlCommandExtractor importSqlCommandExtractor = ImportSqlCommandExtractorInitiator.DEFAULT_EXTRACTOR;
|
||||
|
||||
private String outputFile = null;
|
||||
private String outputFile;
|
||||
private String delimiter;
|
||||
private boolean haltOnError = false;
|
||||
private boolean haltOnError;
|
||||
|
||||
public SchemaExport(ServiceRegistry serviceRegistry, Configuration configuration) {
|
||||
this.connectionHelper = new SuppliedConnectionProviderConnectionHelper(
|
||||
|
|
|
@ -72,16 +72,16 @@ import org.hibernate.internal.util.collections.ArrayHelper;
|
|||
public class SchemaExportTask extends MatchingTask {
|
||||
|
||||
private List fileSets = new LinkedList();
|
||||
private File propertiesFile = null;
|
||||
private File configurationFile = null;
|
||||
private File outputFile = null;
|
||||
private boolean quiet = false;
|
||||
private boolean text = false;
|
||||
private boolean drop = false;
|
||||
private boolean create = false;
|
||||
private boolean haltOnError = false;
|
||||
private String delimiter = null;
|
||||
private String namingStrategy = null;
|
||||
private File propertiesFile;
|
||||
private File configurationFile;
|
||||
private File outputFile;
|
||||
private boolean quiet;
|
||||
private boolean text;
|
||||
private boolean drop;
|
||||
private boolean create;
|
||||
private boolean haltOnError;
|
||||
private String delimiter;
|
||||
private String namingStrategy;
|
||||
|
||||
public void addFileset(FileSet set) {
|
||||
fileSets.add(set);
|
||||
|
|
|
@ -72,9 +72,9 @@ public class SchemaUpdate {
|
|||
|
||||
private Formatter formatter;
|
||||
|
||||
private boolean haltOnError = false;
|
||||
private boolean haltOnError;
|
||||
private boolean format = true;
|
||||
private String outputFile = null;
|
||||
private String outputFile;
|
||||
private String delimiter;
|
||||
|
||||
public SchemaUpdate(Configuration cfg) throws HibernateException {
|
||||
|
|
|
@ -68,14 +68,14 @@ import org.hibernate.internal.util.collections.ArrayHelper;
|
|||
public class SchemaUpdateTask extends MatchingTask {
|
||||
|
||||
private List fileSets = new LinkedList();
|
||||
private File propertiesFile = null;
|
||||
private File configurationFile = null;
|
||||
private File outputFile = null;
|
||||
private boolean quiet = false;
|
||||
private File propertiesFile;
|
||||
private File configurationFile;
|
||||
private File outputFile;
|
||||
private boolean quiet;
|
||||
private boolean text = true;
|
||||
private boolean haltOnError = false;
|
||||
private String delimiter = null;
|
||||
private String namingStrategy = null;
|
||||
private boolean haltOnError;
|
||||
private String delimiter;
|
||||
private String namingStrategy;
|
||||
|
||||
|
||||
public void addFileset(FileSet set) {
|
||||
|
|
|
@ -67,9 +67,9 @@ import org.hibernate.internal.util.collections.ArrayHelper;
|
|||
public class SchemaValidatorTask extends MatchingTask {
|
||||
|
||||
private List fileSets = new LinkedList();
|
||||
private File propertiesFile = null;
|
||||
private File configurationFile = null;
|
||||
private String namingStrategy = null;
|
||||
private File propertiesFile;
|
||||
private File configurationFile;
|
||||
private String namingStrategy;
|
||||
|
||||
public void addFileset(FileSet set) {
|
||||
fileSets.add(set);
|
||||
|
|
|
@ -167,7 +167,7 @@ public class CacheableResultTransformer implements ResultTransformer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Object transformTuple(Object[] tuple, String aliases[]) {
|
||||
public Object transformTuple(Object[] tuple, String[] aliases) {
|
||||
if ( aliases != null && aliases.length != tupleLength ) {
|
||||
throw new IllegalStateException(
|
||||
"aliases expected length is " + tupleLength +
|
||||
|
@ -199,7 +199,7 @@ public class CacheableResultTransformer implements ResultTransformer {
|
|||
@SuppressWarnings( {"unchecked"})
|
||||
public List retransformResults(
|
||||
List transformedResults,
|
||||
String aliases[],
|
||||
String[] aliases,
|
||||
ResultTransformer transformer,
|
||||
boolean[] includeInTuple) {
|
||||
if ( transformer == null ) {
|
||||
|
|
|
@ -66,7 +66,10 @@ import org.hibernate.type.VersionType;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class PropertyFactory {
|
||||
public final class PropertyFactory {
|
||||
private PropertyFactory() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates the attribute representation of the identifier for a given entity mapping.
|
||||
*
|
||||
|
|
|
@ -81,7 +81,7 @@ public abstract class AbstractCompositionAttribute
|
|||
public Iterator<AttributeDefinition> iterator() {
|
||||
return new Iterator<AttributeDefinition>() {
|
||||
private final int numberOfAttributes = getType().getSubtypes().length;
|
||||
private int currentSubAttributeNumber = 0;
|
||||
private int currentSubAttributeNumber;
|
||||
private int currentColumnPosition = columnStartPosition;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,9 +27,8 @@ import java.io.Serializable;
|
|||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.usertype.CompositeUserType;
|
||||
import org.hibernate.usertype.UserType;
|
||||
|
@ -40,12 +39,11 @@ import org.hibernate.usertype.UserType;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
public class BasicTypeRegistry implements Serializable {
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, BasicTypeRegistry.class.getName());
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( BasicTypeRegistry.class );
|
||||
|
||||
// TODO : analyze these sizing params; unfortunately this seems to be the only way to give a "concurrencyLevel"
|
||||
private Map<String,BasicType> registry = new ConcurrentHashMap<String, BasicType>( 100, .75f, 1 );
|
||||
private boolean locked = false;
|
||||
private boolean locked;
|
||||
|
||||
public BasicTypeRegistry() {
|
||||
register( BooleanType.INSTANCE );
|
||||
|
|
|
@ -42,9 +42,11 @@ import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
@SuppressWarnings( {"UnusedDeclaration"})
|
||||
public class StandardBasicTypes {
|
||||
public final class StandardBasicTypes {
|
||||
private StandardBasicTypes() {
|
||||
}
|
||||
|
||||
private static final Set<SqlTypeDescriptor> sqlTypeDescriptors = new HashSet<SqlTypeDescriptor>();
|
||||
private static final Set<SqlTypeDescriptor> SQL_TYPE_DESCRIPTORS = new HashSet<SqlTypeDescriptor>();
|
||||
|
||||
/**
|
||||
* The standard Hibernate type for mapping {@link Boolean} to JDBC {@link java.sql.Types#BIT BIT}.
|
||||
|
|
|
@ -28,9 +28,8 @@ import java.util.Collections;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.internal.CoreLogging;
|
||||
import org.hibernate.internal.CoreMessageLogger;
|
||||
|
||||
/**
|
||||
|
@ -38,9 +37,9 @@ import org.hibernate.internal.CoreMessageLogger;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class JdbcTypeNameMapper {
|
||||
public final class JdbcTypeNameMapper {
|
||||
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( JdbcTypeNameMapper.class );
|
||||
|
||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, JdbcTypeNameMapper.class.getName());
|
||||
private static Map<Integer,String> JDBC_TYPE_MAP = buildJdbcTypeMap();
|
||||
|
||||
private static Map<Integer, String> buildJdbcTypeMap() {
|
||||
|
@ -104,4 +103,8 @@ public class JdbcTypeNameMapper {
|
|||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
private JdbcTypeNameMapper() {
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -44,7 +44,9 @@ import org.hibernate.engine.jdbc.BinaryStream;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class DataHelper {
|
||||
public final class DataHelper {
|
||||
private DataHelper() {
|
||||
}
|
||||
|
||||
/** The size of the buffer we will use to deserialize larger streams */
|
||||
private static final int BUFFER_SIZE = 1024 * 4;
|
||||
|
|
|
@ -53,16 +53,18 @@ import org.hibernate.mapping.Array;
|
|||
public class JdbcTypeJavaClassMappings {
|
||||
private static final Logger log = Logger.getLogger( JdbcTypeJavaClassMappings.class );
|
||||
|
||||
private static final ConcurrentHashMap<Class, Integer> javaClassToJdbcTypeCodeMap = buildJdbcJavaClassMappings();
|
||||
private static final ConcurrentHashMap<Integer, Class> jdbcTypeCodeToJavaClassMap = transpose( javaClassToJdbcTypeCodeMap );
|
||||
|
||||
public static final JdbcTypeJavaClassMappings INSTANCE = new JdbcTypeJavaClassMappings();
|
||||
|
||||
private final ConcurrentHashMap<Class, Integer> javaClassToJdbcTypeCodeMap;
|
||||
private final ConcurrentHashMap<Integer, Class> jdbcTypeCodeToJavaClassMap;
|
||||
|
||||
private JdbcTypeJavaClassMappings() {
|
||||
javaClassToJdbcTypeCodeMap = buildJdbcJavaClassMappings();
|
||||
jdbcTypeCodeToJavaClassMap = transpose( javaClassToJdbcTypeCodeMap );
|
||||
}
|
||||
|
||||
public int determineJdbcTypeCodeForJavaClass(Class cls) {
|
||||
Integer typeCode = JdbcTypeJavaClassMappings.javaClassToJdbcTypeCodeMap.get( cls );
|
||||
Integer typeCode = javaClassToJdbcTypeCodeMap.get( cls );
|
||||
if ( typeCode != null ) {
|
||||
return typeCode;
|
||||
}
|
||||
|
@ -74,8 +76,8 @@ public class JdbcTypeJavaClassMappings {
|
|||
return specialCode;
|
||||
}
|
||||
|
||||
public Class determineJavaClassForJdbcTypeCode(int typeCode) {
|
||||
Class cls = jdbcTypeCodeToJavaClassMap.get( Integer.valueOf( typeCode ) );
|
||||
public Class determineJavaClassForJdbcTypeCode(Integer typeCode) {
|
||||
Class cls = jdbcTypeCodeToJavaClassMap.get( typeCode );
|
||||
if ( cls != null ) {
|
||||
return cls;
|
||||
}
|
||||
|
@ -87,6 +89,10 @@ public class JdbcTypeJavaClassMappings {
|
|||
return Object.class;
|
||||
}
|
||||
|
||||
public Class determineJavaClassForJdbcTypeCode(int typeCode) {
|
||||
return determineJavaClassForJdbcTypeCode( Integer.valueOf( typeCode ) );
|
||||
}
|
||||
|
||||
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
|
|
@ -102,4 +102,4 @@ public class HibernatePersistence extends HibernatePersistenceProvider implement
|
|||
logDeprecation();
|
||||
return super.getEntityManagerFactoryBuilderOrNull( persistenceUnitName, properties );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,8 +49,8 @@ public class ParsedPersistenceXmlDescriptor implements org.hibernate.jpa.boot.sp
|
|||
private Object jtaDataSource;
|
||||
private String providerClassName;
|
||||
private PersistenceUnitTransactionType transactionType;
|
||||
private boolean useQuotedIdentifiers = false;
|
||||
private boolean excludeUnlistedClasses = false;
|
||||
private boolean useQuotedIdentifiers;
|
||||
private boolean excludeUnlistedClasses;
|
||||
private ValidationMode validationMode;
|
||||
private SharedCacheMode sharedCacheMode;
|
||||
|
||||
|
|
|
@ -37,6 +37,9 @@ import org.hibernate.jpa.boot.internal.PersistenceUnitInfoDescriptor;
|
|||
* @author Brett Meyer
|
||||
*/
|
||||
public final class Bootstrap {
|
||||
private Bootstrap() {
|
||||
}
|
||||
|
||||
public static EntityManagerFactoryBuilder getEntityManagerFactoryBuilder(
|
||||
PersistenceUnitDescriptor persistenceUnitDescriptor,
|
||||
Map integration) {
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.hibernate.jpa.HibernatePersistenceProvider;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class ProviderChecker {
|
||||
public final class ProviderChecker {
|
||||
private static final Logger log = Logger.getLogger( ProviderChecker.class );
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
@ -128,4 +128,7 @@ public class ProviderChecker {
|
|||
final String persistenceUnitRequestedProvider = persistenceUnit.getProviderClassName();
|
||||
return persistenceUnitRequestedProvider == null ? null : persistenceUnitRequestedProvider.trim();
|
||||
}
|
||||
|
||||
private ProviderChecker() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.jpa.criteria;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
|
@ -30,7 +31,7 @@ import java.io.Serializable;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class AbstractNode implements Serializable {
|
||||
public abstract class AbstractNode implements Serializable {
|
||||
private final CriteriaBuilderImpl criteriaBuilder;
|
||||
|
||||
public AbstractNode(CriteriaBuilderImpl criteriaBuilder) {
|
||||
|
|
|
@ -67,8 +67,8 @@ public class CriteriaCompiler implements Serializable {
|
|||
final List<ImplicitParameterBinding> implicitParameterBindings = new ArrayList<ImplicitParameterBinding>();
|
||||
|
||||
RenderingContext renderingContext = new RenderingContext() {
|
||||
private int aliasCount = 0;
|
||||
private int explicitParameterCount = 0;
|
||||
private int aliasCount;
|
||||
private int explicitParameterCount;
|
||||
|
||||
public String generateAlias() {
|
||||
return "generatedAlias" + aliasCount++;
|
||||
|
|
|
@ -50,4 +50,4 @@ public class NullLiteralExpression<T> extends ExpressionImpl<T> implements Seria
|
|||
public String renderProjection(RenderingContext renderingContext) {
|
||||
return render( renderingContext );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,4 +64,4 @@ public class BooleanStaticAssertionPredicate
|
|||
return isTrue ? "1=1" : "0=1";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,10 @@ import java.math.BigInteger;
|
|||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class ImplicitNumericExpressionTypeDeterminer {
|
||||
public final class ImplicitNumericExpressionTypeDeterminer {
|
||||
private ImplicitNumericExpressionTypeDeterminer() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the appropriate runtime result type for a numeric expression according to
|
||||
* section "6.5.7.1 Result Types of Expressions" of the JPA spec.
|
||||
|
|
|
@ -29,4 +29,4 @@ package org.hibernate.jpa.event.internal.core;
|
|||
* <li>provide tweaks to internal processing to conform with JPA spec</li>
|
||||
* <li>bridge to JPA event callbacks</li>
|
||||
* </ul>
|
||||
*/
|
||||
*/
|
||||
|
|
|
@ -25,4 +25,4 @@ package org.hibernate.jpa.event.internal.jpa;
|
|||
|
||||
/**
|
||||
* Classes for integrating with JPA event callbacks
|
||||
*/
|
||||
*/
|
||||
|
|
|
@ -25,4 +25,4 @@ package org.hibernate.jpa.event.spi.jpa;
|
|||
|
||||
/**
|
||||
* SPI classes for integrating with JPA event callbacks
|
||||
*/
|
||||
*/
|
||||
|
|
|
@ -67,7 +67,7 @@ public abstract class AbstractManagedType<X>
|
|||
return superType;
|
||||
}
|
||||
|
||||
private boolean locked = false;
|
||||
private boolean locked;
|
||||
|
||||
public Builder<X> getBuilder() {
|
||||
if ( locked ) {
|
||||
|
|
|
@ -34,7 +34,10 @@ import org.hibernate.CacheMode;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class CacheModeHelper {
|
||||
public final class CacheModeHelper {
|
||||
private CacheModeHelper() {
|
||||
}
|
||||
|
||||
public static final CacheMode DEFAULT_LEGACY_MODE = CacheMode.NORMAL;
|
||||
public static final CacheStoreMode DEFAULT_STORE_MODE = CacheStoreMode.USE;
|
||||
public static final CacheRetrieveMode DEFAULT_RETRIEVE_MODE = CacheRetrieveMode.USE;
|
||||
|
|
|
@ -33,7 +33,10 @@ import org.hibernate.internal.util.LockModeConverter;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
public class LockModeTypeHelper {
|
||||
public final class LockModeTypeHelper {
|
||||
private LockModeTypeHelper() {
|
||||
}
|
||||
|
||||
public static LockModeType getLockModeType(LockMode lockMode) {
|
||||
return LockModeConverter.convertToLockModeType( lockMode );
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue