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