HHH-8741 - More checkstyle cleanups
This commit is contained in:
parent
66d3902ec2
commit
8fe5460ec0
|
@ -47,9 +47,7 @@ public class OnUpdateVisitor extends ReattachVisitor {
|
||||||
super( session, key, owner );
|
super( session, key, owner );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
Object processCollection(Object collection, CollectionType type) throws HibernateException {
|
Object processCollection(Object collection, CollectionType type) throws HibernateException {
|
||||||
|
|
||||||
if ( collection == CollectionType.UNFETCHED_COLLECTION ) {
|
if ( collection == CollectionType.UNFETCHED_COLLECTION ) {
|
||||||
|
|
|
@ -479,7 +479,7 @@ public final class HqlParser extends HqlBaseParser {
|
||||||
return treatMap == null ? Collections.<String, Set<String>>emptyMap() : treatMap;
|
return treatMap == null ? Collections.<String, Set<String>>emptyMap() : treatMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
static public void panic() {
|
public static void panic() {
|
||||||
//overriden to avoid System.exit
|
//overriden to avoid System.exit
|
||||||
throw new QueryException( "Parser: panic" );
|
throw new QueryException( "Parser: panic" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -606,7 +606,7 @@ public class QueryTranslatorImpl implements FilterTranslator {
|
||||||
public void visit(AST node) {
|
public void visit(AST node) {
|
||||||
if ( dotRoot != null ) {
|
if ( dotRoot != null ) {
|
||||||
// we are already processing a dot-structure
|
// we are already processing a dot-structure
|
||||||
if ( ASTUtil.isSubtreeChild(dotRoot, node) ) {
|
if ( ASTUtil.isSubtreeChild( dotRoot, node ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// we are now at a new tree level
|
// we are now at a new tree level
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class AssignmentSpecification {
|
||||||
hqlParameters = new ParameterSpecification[0];
|
hqlParameters = new ParameterSpecification[0];
|
||||||
}
|
}
|
||||||
else if ( isParam( rhs ) ) {
|
else if ( isParam( rhs ) ) {
|
||||||
hqlParameters = new ParameterSpecification[] { ( ( ParameterNode ) rhs ).getHqlParameterSpecification() };
|
hqlParameters = new ParameterSpecification[] { ( (ParameterNode) rhs ).getHqlParameterSpecification() };
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
List parameterList = ASTUtil.collectChildren(
|
List parameterList = ASTUtil.collectChildren(
|
||||||
|
@ -110,7 +110,7 @@ public class AssignmentSpecification {
|
||||||
Iterator itr = parameterList.iterator();
|
Iterator itr = parameterList.iterator();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while( itr.hasNext() ) {
|
while( itr.hasNext() ) {
|
||||||
hqlParameters[i++] = ( ( ParameterNode ) itr.next() ).getHqlParameterSpecification();
|
hqlParameters[i++] = ( (ParameterNode) itr.next() ).getHqlParameterSpecification();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,8 +48,8 @@ public class BinaryArithmeticOperatorNode extends AbstractSelectExpression imple
|
||||||
throw new SemanticException( "right-hand operand of a binary operator was null" );
|
throw new SemanticException( "right-hand operand of a binary operator was null" );
|
||||||
}
|
}
|
||||||
|
|
||||||
final Type lhType = ( lhs instanceof SqlNode ) ? ( ( SqlNode ) lhs ).getDataType() : null;
|
final Type lhType = ( lhs instanceof SqlNode ) ? ( (SqlNode) lhs ).getDataType() : null;
|
||||||
final Type rhType = ( rhs instanceof SqlNode ) ? ( ( SqlNode ) rhs ).getDataType() : null;
|
final Type rhType = ( rhs instanceof SqlNode ) ? ( (SqlNode) rhs ).getDataType() : null;
|
||||||
|
|
||||||
if ( ExpectedTypeAwareNode.class.isAssignableFrom( lhs.getClass() ) && rhType != null ) {
|
if ( ExpectedTypeAwareNode.class.isAssignableFrom( lhs.getClass() ) && rhType != null ) {
|
||||||
Type expectedType = null;
|
Type expectedType = null;
|
||||||
|
@ -84,7 +84,7 @@ public class BinaryArithmeticOperatorNode extends AbstractSelectExpression imple
|
||||||
else {
|
else {
|
||||||
expectedType = lhType;
|
expectedType = lhType;
|
||||||
}
|
}
|
||||||
( ( ExpectedTypeAwareNode ) rhs ).setExpectedType( expectedType );
|
( (ExpectedTypeAwareNode) rhs ).setExpectedType( expectedType );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,8 +107,8 @@ public class BinaryArithmeticOperatorNode extends AbstractSelectExpression imple
|
||||||
// makes any sense.
|
// makes any sense.
|
||||||
Node lhs = getLeftHandOperand();
|
Node lhs = getLeftHandOperand();
|
||||||
Node rhs = getRightHandOperand();
|
Node rhs = getRightHandOperand();
|
||||||
Type lhType = ( lhs instanceof SqlNode ) ? ( ( SqlNode ) lhs ).getDataType() : null;
|
Type lhType = ( lhs instanceof SqlNode ) ? ( (SqlNode) lhs ).getDataType() : null;
|
||||||
Type rhType = ( rhs instanceof SqlNode ) ? ( ( SqlNode ) rhs ).getDataType() : null;
|
Type rhType = ( rhs instanceof SqlNode ) ? ( (SqlNode) rhs ).getDataType() : null;
|
||||||
if ( isDateTimeType( lhType ) || isDateTimeType( rhType ) ) {
|
if ( isDateTimeType( lhType ) || isDateTimeType( rhType ) ) {
|
||||||
return resolveDateTimeArithmeticResultType( lhType, rhType );
|
return resolveDateTimeArithmeticResultType( lhType, rhType );
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ public class BinaryArithmeticOperatorNode extends AbstractSelectExpression imple
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Node getLeftHandOperand() {
|
public Node getLeftHandOperand() {
|
||||||
return ( Node ) getFirstChild();
|
return (Node) getFirstChild();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -219,7 +219,7 @@ public class BinaryArithmeticOperatorNode extends AbstractSelectExpression imple
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Node getRightHandOperand() {
|
public Node getRightHandOperand() {
|
||||||
return ( Node ) getFirstChild().getNextSibling();
|
return (Node) getFirstChild().getNextSibling();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -133,12 +133,12 @@ public class BinaryLogicOperatorNode extends HqlSqlWalkerNode implements BinaryO
|
||||||
ParameterSpecification lhsEmbeddedCompositeParameterSpecification =
|
ParameterSpecification lhsEmbeddedCompositeParameterSpecification =
|
||||||
getLeftHandOperand() == null || ( !ParameterNode.class.isInstance( getLeftHandOperand() ) )
|
getLeftHandOperand() == null || ( !ParameterNode.class.isInstance( getLeftHandOperand() ) )
|
||||||
? null
|
? null
|
||||||
: ( ( ParameterNode ) getLeftHandOperand() ).getHqlParameterSpecification();
|
: ( (ParameterNode) getLeftHandOperand() ).getHqlParameterSpecification();
|
||||||
|
|
||||||
ParameterSpecification rhsEmbeddedCompositeParameterSpecification =
|
ParameterSpecification rhsEmbeddedCompositeParameterSpecification =
|
||||||
getRightHandOperand() == null || ( !ParameterNode.class.isInstance( getRightHandOperand() ) )
|
getRightHandOperand() == null || ( !ParameterNode.class.isInstance( getRightHandOperand() ) )
|
||||||
? null
|
? null
|
||||||
: ( ( ParameterNode ) getRightHandOperand() ).getHqlParameterSpecification();
|
: ( (ParameterNode) getRightHandOperand() ).getHqlParameterSpecification();
|
||||||
|
|
||||||
translate(
|
translate(
|
||||||
valueElements,
|
valueElements,
|
||||||
|
|
|
@ -59,7 +59,7 @@ 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;
|
public static boolean useThetaStyleImplicitJoins;
|
||||||
public static boolean REGRESSION_STYLE_JOIN_SUPPRESSION;
|
public static boolean regressionStyleJoinSuppression;
|
||||||
|
|
||||||
public static interface IllegalCollectionDereferenceExceptionBuilder {
|
public static interface IllegalCollectionDereferenceExceptionBuilder {
|
||||||
public QueryException buildIllegalCollectionDereferenceException(
|
public QueryException buildIllegalCollectionDereferenceException(
|
||||||
|
@ -112,7 +112,7 @@ public class DotNode extends FromReferenceNode implements DisplayableNode, Selec
|
||||||
/**
|
/**
|
||||||
* Fetch join or not.
|
* Fetch join or not.
|
||||||
*/
|
*/
|
||||||
private boolean fetch = false;
|
private boolean fetch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of dereference that hapened
|
* The type of dereference that hapened
|
||||||
|
@ -367,9 +367,9 @@ public class DotNode extends FromReferenceNode implements DisplayableNode, Selec
|
||||||
// 2) is this a DML statement
|
// 2) is this a DML statement
|
||||||
// 3) we were asked to generate any needed joins (generateJoins==true) *OR*
|
// 3) we were asked to generate any needed joins (generateJoins==true) *OR*
|
||||||
// we are currently processing a select or from clause
|
// we are currently processing a select or from clause
|
||||||
// (an additional check is the REGRESSION_STYLE_JOIN_SUPPRESSION check solely intended for the test suite)
|
// (an additional check is the regressionStyleJoinSuppression check solely intended for the test suite)
|
||||||
//
|
//
|
||||||
// The REGRESSION_STYLE_JOIN_SUPPRESSION is an additional check
|
// The regressionStyleJoinSuppression is an additional check
|
||||||
// intended solely for use within the test suite. This forces the
|
// intended solely for use within the test suite. This forces the
|
||||||
// implicit join resolution to behave more like the classic parser.
|
// implicit join resolution to behave more like the classic parser.
|
||||||
// The underlying issue is that classic translator is simply wrong
|
// The underlying issue is that classic translator is simply wrong
|
||||||
|
@ -397,7 +397,7 @@ public class DotNode extends FromReferenceNode implements DisplayableNode, Selec
|
||||||
// in non-select queries, the only time we should need to join is if we are in a subquery from clause
|
// in non-select queries, the only time we should need to join is if we are in a subquery from clause
|
||||||
joinIsNeeded = getWalker().getCurrentStatementType() == SqlTokenTypes.SELECT && getWalker().isInFrom();
|
joinIsNeeded = getWalker().getCurrentStatementType() == SqlTokenTypes.SELECT && getWalker().isInFrom();
|
||||||
}
|
}
|
||||||
else if ( REGRESSION_STYLE_JOIN_SUPPRESSION ) {
|
else if ( regressionStyleJoinSuppression ) {
|
||||||
// this is the regression style determination which matches the logic of the classic translator
|
// this is the regression style determination which matches the logic of the classic translator
|
||||||
joinIsNeeded = generateJoin && ( !getWalker().isInSelect() || !getWalker().isShallowQuery() );
|
joinIsNeeded = generateJoin && ( !getWalker().isInSelect() || !getWalker().isShallowQuery() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -518,9 +518,7 @@ class FromElementType {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SpecialManyToManyCollectionPropertyMapping implements PropertyMapping {
|
private class SpecialManyToManyCollectionPropertyMapping implements PropertyMapping {
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Type getType() {
|
public Type getType() {
|
||||||
return queryableCollection.getCollectionType();
|
return queryableCollection.getCollectionType();
|
||||||
}
|
}
|
||||||
|
@ -533,17 +531,13 @@ class FromElementType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Type toType(String propertyName) throws QueryException {
|
public Type toType(String propertyName) throws QueryException {
|
||||||
validate( propertyName );
|
validate( propertyName );
|
||||||
return queryableCollection.getIndexType();
|
return queryableCollection.getIndexType();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String[] toColumns(String alias, String propertyName) throws QueryException {
|
public String[] toColumns(String alias, String propertyName) throws QueryException {
|
||||||
validate( propertyName );
|
validate( propertyName );
|
||||||
final String joinTableAlias = joinSequence.getFirstJoin().getAlias();
|
final String joinTableAlias = joinSequence.getFirstJoin().getAlias();
|
||||||
|
@ -566,9 +560,7 @@ class FromElementType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String[] toColumns(String propertyName) throws QueryException, UnsupportedOperationException {
|
public String[] toColumns(String propertyName) throws QueryException, UnsupportedOperationException {
|
||||||
validate( propertyName );
|
validate( propertyName );
|
||||||
return queryableCollection.toColumns( propertyName );
|
return queryableCollection.toColumns( propertyName );
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class IdentNode extends FromReferenceNode implements SelectExpression {
|
||||||
COMPONENT_REF
|
COMPONENT_REF
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean nakedPropertyRef = false;
|
private boolean nakedPropertyRef;
|
||||||
|
|
||||||
public void resolveIndex(AST parent) throws SemanticException {
|
public void resolveIndex(AST parent) throws SemanticException {
|
||||||
// An ident node can represent an index expression if the ident
|
// An ident node can represent an index expression if the ident
|
||||||
|
|
|
@ -112,25 +112,22 @@ public class CompositeNestedGeneratedValueGenerator implements IdentifierGenerat
|
||||||
generationPlans.add( plan );
|
generationPlans.add( plan );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Serializable generate(SessionImplementor session, Object object) throws HibernateException {
|
public Serializable generate(SessionImplementor session, Object object) throws HibernateException {
|
||||||
final Serializable context = generationContextLocator.locateGenerationContext( session, object );
|
final Serializable context = generationContextLocator.locateGenerationContext( session, object );
|
||||||
|
|
||||||
Iterator itr = generationPlans.iterator();
|
for ( Object generationPlan : generationPlans ) {
|
||||||
while ( itr.hasNext() ) {
|
final GenerationPlan plan = (GenerationPlan) generationPlan;
|
||||||
final GenerationPlan plan = (GenerationPlan) itr.next();
|
|
||||||
plan.execute( session, object, context );
|
plan.execute( session, object, context );
|
||||||
}
|
}
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void registerPersistentGenerators(Map generatorMap) {
|
public void registerPersistentGenerators(Map generatorMap) {
|
||||||
final Iterator itr = generationPlans.iterator();
|
for ( Object generationPlan : generationPlans ) {
|
||||||
while ( itr.hasNext() ) {
|
final GenerationPlan plan = (GenerationPlan) generationPlan;
|
||||||
final GenerationPlan plan = (GenerationPlan) itr.next();
|
|
||||||
plan.registerPersistentGenerators( generatorMap );
|
plan.registerPersistentGenerators( generatorMap );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,9 +79,7 @@ public class ForeignGenerator implements IdentifierGenerator, Configurable {
|
||||||
return getEntityName() + '.' + getPropertyName();
|
return getEntityName() + '.' + getPropertyName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void configure(Type type, Properties params, Dialect d) {
|
public void configure(Type type, Properties params, Dialect d) {
|
||||||
propertyName = params.getProperty( "property" );
|
propertyName = params.getProperty( "property" );
|
||||||
entityName = params.getProperty( ENTITY_NAME );
|
entityName = params.getProperty( ENTITY_NAME );
|
||||||
|
@ -90,9 +88,7 @@ public class ForeignGenerator implements IdentifierGenerator, Configurable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Serializable generate(SessionImplementor sessionImplementor, Object object) {
|
public Serializable generate(SessionImplementor sessionImplementor, Object object) {
|
||||||
Session session = ( Session ) sessionImplementor;
|
Session session = ( Session ) sessionImplementor;
|
||||||
|
|
||||||
|
|
|
@ -323,6 +323,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return new SharedSessionBuilderImpl( this );
|
return new SharedSessionBuilderImpl( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
// Do not call checkTransactionSynchStatus() here -- if a delayed
|
// Do not call checkTransactionSynchStatus() here -- if a delayed
|
||||||
|
@ -341,11 +342,13 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public long getTimestamp() {
|
public long getTimestamp() {
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return timestamp;
|
return timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Connection close() throws HibernateException {
|
public Connection close() throws HibernateException {
|
||||||
LOG.trace( "Closing session" );
|
LOG.trace( "Closing session" );
|
||||||
if ( isClosed() ) {
|
if ( isClosed() ) {
|
||||||
|
@ -377,6 +380,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ConnectionReleaseMode getConnectionReleaseMode() {
|
public ConnectionReleaseMode getConnectionReleaseMode() {
|
||||||
return connectionReleaseMode;
|
return connectionReleaseMode;
|
||||||
}
|
}
|
||||||
|
@ -386,23 +390,28 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return autoJoinTransactions;
|
return autoJoinTransactions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isAutoCloseSessionEnabled() {
|
public boolean isAutoCloseSessionEnabled() {
|
||||||
return autoCloseSessionEnabled;
|
return autoCloseSessionEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isOpen() {
|
public boolean isOpen() {
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return !isClosed();
|
return !isClosed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isFlushModeNever() {
|
public boolean isFlushModeNever() {
|
||||||
return FlushMode.isManualFlushMode( getFlushMode() );
|
return FlushMode.isManualFlushMode( getFlushMode() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isFlushBeforeCompletionEnabled() {
|
public boolean isFlushBeforeCompletionEnabled() {
|
||||||
return flushBeforeCompletionEnabled;
|
return flushBeforeCompletionEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void managedFlush() {
|
public void managedFlush() {
|
||||||
if ( isClosed() ) {
|
if ( isClosed() ) {
|
||||||
LOG.trace( "Skipping auto-flush due to session closed" );
|
LOG.trace( "Skipping auto-flush due to session closed" );
|
||||||
|
@ -425,21 +434,25 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void managedClose() {
|
public void managedClose() {
|
||||||
LOG.trace( "Automatically closing session" );
|
LOG.trace( "Automatically closing session" );
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Connection connection() throws HibernateException {
|
public Connection connection() throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
return transactionCoordinator.getJdbcCoordinator().getLogicalConnection().getConnection();
|
return transactionCoordinator.getJdbcCoordinator().getLogicalConnection().getConnection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isConnected() {
|
public boolean isConnected() {
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return !isClosed() && transactionCoordinator.getJdbcCoordinator().getLogicalConnection().isOpen();
|
return !isClosed() && transactionCoordinator.getJdbcCoordinator().getLogicalConnection().isOpen();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isTransactionInProgress() {
|
public boolean isTransactionInProgress() {
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return !isClosed() && transactionCoordinator.isTransactionInProgress();
|
return !isClosed() && transactionCoordinator.isTransactionInProgress();
|
||||||
|
@ -461,6 +474,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
transactionCoordinator.getJdbcCoordinator().getLogicalConnection().manualReconnect( conn );
|
transactionCoordinator.getJdbcCoordinator().getLogicalConnection().manualReconnect( conn );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setAutoClear(boolean enabled) {
|
public void setAutoClear(boolean enabled) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
autoClear = enabled;
|
autoClear = enabled;
|
||||||
|
@ -584,6 +598,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
persistenceContext.clear();
|
persistenceContext.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public LockMode getCurrentLockMode(Object object) throws HibernateException {
|
public LockMode getCurrentLockMode(Object object) throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
|
@ -610,6 +625,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return e.getLockMode();
|
return e.getLockMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getEntityUsingInterceptor(EntityKey key) throws HibernateException {
|
public Object getEntityUsingInterceptor(EntityKey key) throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
// todo : should this get moved to PersistentContext?
|
// todo : should this get moved to PersistentContext?
|
||||||
|
@ -646,10 +662,12 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
|
|
||||||
// saveOrUpdate() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// saveOrUpdate() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@Override
|
||||||
public void saveOrUpdate(Object object) throws HibernateException {
|
public void saveOrUpdate(Object object) throws HibernateException {
|
||||||
saveOrUpdate( null, object );
|
saveOrUpdate( null, object );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void saveOrUpdate(String entityName, Object obj) throws HibernateException {
|
public void saveOrUpdate(String entityName, Object obj) throws HibernateException {
|
||||||
fireSaveOrUpdate( new SaveOrUpdateEvent( entityName, obj, this ) );
|
fireSaveOrUpdate( new SaveOrUpdateEvent( entityName, obj, this ) );
|
||||||
}
|
}
|
||||||
|
@ -675,10 +693,12 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
|
|
||||||
// save() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// save() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@Override
|
||||||
public Serializable save(Object obj) throws HibernateException {
|
public Serializable save(Object obj) throws HibernateException {
|
||||||
return save( null, obj );
|
return save( null, obj );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Serializable save(String entityName, Object object) throws HibernateException {
|
public Serializable save(String entityName, Object object) throws HibernateException {
|
||||||
return fireSave( new SaveOrUpdateEvent( entityName, object, this ) );
|
return fireSave( new SaveOrUpdateEvent( entityName, object, this ) );
|
||||||
}
|
}
|
||||||
|
@ -697,10 +717,12 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
|
|
||||||
// update() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// update() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@Override
|
||||||
public void update(Object obj) throws HibernateException {
|
public void update(Object obj) throws HibernateException {
|
||||||
update( null, obj );
|
update( null, obj );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void update(String entityName, Object object) throws HibernateException {
|
public void update(String entityName, Object object) throws HibernateException {
|
||||||
fireUpdate( new SaveOrUpdateEvent( entityName, object, this ) );
|
fireUpdate( new SaveOrUpdateEvent( entityName, object, this ) );
|
||||||
}
|
}
|
||||||
|
@ -718,14 +740,17 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
|
|
||||||
// lock() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// lock() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@Override
|
||||||
public void lock(String entityName, Object object, LockMode lockMode) throws HibernateException {
|
public void lock(String entityName, Object object, LockMode lockMode) throws HibernateException {
|
||||||
fireLock( new LockEvent( entityName, object, lockMode, this ) );
|
fireLock( new LockEvent( entityName, object, lockMode, this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public LockRequest buildLockRequest(LockOptions lockOptions) {
|
public LockRequest buildLockRequest(LockOptions lockOptions) {
|
||||||
return new LockRequestImpl(lockOptions);
|
return new LockRequestImpl(lockOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void lock(Object object, LockMode lockMode) throws HibernateException {
|
public void lock(Object object, LockMode lockMode) throws HibernateException {
|
||||||
fireLock( new LockEvent( object, lockMode, this ) );
|
fireLock( new LockEvent( object, lockMode, this ) );
|
||||||
}
|
}
|
||||||
|
@ -750,16 +775,18 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
|
|
||||||
// persist() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// persist() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@Override
|
||||||
public void persist(String entityName, Object object) throws HibernateException {
|
public void persist(String entityName, Object object) throws HibernateException {
|
||||||
firePersist( new PersistEvent( entityName, object, this ) );
|
firePersist( new PersistEvent( entityName, object, this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void persist(Object object) throws HibernateException {
|
public void persist(Object object) throws HibernateException {
|
||||||
persist( null, object );
|
persist( null, object );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void persist(String entityName, Object object, Map copiedAlready)
|
@Override
|
||||||
throws HibernateException {
|
public void persist(String entityName, Object object, Map copiedAlready) throws HibernateException {
|
||||||
firePersist( copiedAlready, new PersistEvent( entityName, object, this ) );
|
firePersist( copiedAlready, new PersistEvent( entityName, object, this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -794,6 +821,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
persist( null, object );
|
persist( null, object );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void persistOnFlush(String entityName, Object object, Map copiedAlready)
|
public void persistOnFlush(String entityName, Object object, Map copiedAlready)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
firePersistOnFlush( copiedAlready, new PersistEvent( entityName, object, this ) );
|
firePersistOnFlush( copiedAlready, new PersistEvent( entityName, object, this ) );
|
||||||
|
@ -821,14 +849,17 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
|
|
||||||
// merge() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// merge() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object merge(String entityName, Object object) throws HibernateException {
|
public Object merge(String entityName, Object object) throws HibernateException {
|
||||||
return fireMerge( new MergeEvent( entityName, object, this ) );
|
return fireMerge( new MergeEvent( entityName, object, this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object merge(Object object) throws HibernateException {
|
public Object merge(Object object) throws HibernateException {
|
||||||
return merge( null, object );
|
return merge( null, object );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void merge(String entityName, Object object, Map copiedAlready) throws HibernateException {
|
public void merge(String entityName, Object object, Map copiedAlready) throws HibernateException {
|
||||||
fireMerge( copiedAlready, new MergeEvent( entityName, object, this ) );
|
fireMerge( copiedAlready, new MergeEvent( entityName, object, this ) );
|
||||||
}
|
}
|
||||||
|
@ -856,30 +887,25 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
|
|
||||||
// delete() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// delete() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Delete a persistent object
|
|
||||||
*/
|
|
||||||
public void delete(Object object) throws HibernateException {
|
public void delete(Object object) throws HibernateException {
|
||||||
fireDelete( new DeleteEvent( object, this ) );
|
fireDelete( new DeleteEvent( object, this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Delete a persistent object (by explicit entity name)
|
|
||||||
*/
|
|
||||||
public void delete(String entityName, Object object) throws HibernateException {
|
public void delete(String entityName, Object object) throws HibernateException {
|
||||||
fireDelete( new DeleteEvent( entityName, object, this ) );
|
fireDelete( new DeleteEvent( entityName, object, this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Delete a persistent object
|
|
||||||
*/
|
|
||||||
public void delete(String entityName, Object object, boolean isCascadeDeleteEnabled, Set transientEntities) throws HibernateException {
|
public void delete(String entityName, Object object, boolean isCascadeDeleteEnabled, Set transientEntities) throws HibernateException {
|
||||||
fireDelete( new DeleteEvent( entityName, object, isCascadeDeleteEnabled, this ), transientEntities );
|
fireDelete( new DeleteEvent( entityName, object, isCascadeDeleteEnabled, this ), transientEntities );
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: The removeOrphan concept is a temporary "hack" for HHH-6484. This should be removed once action/task
|
@Override
|
||||||
// ordering is improved.
|
|
||||||
public void removeOrphanBeforeUpdates(String entityName, Object child) {
|
public void removeOrphanBeforeUpdates(String entityName, Object child) {
|
||||||
|
// TODO: The removeOrphan concept is a temporary "hack" for HHH-6484. This should be removed once action/task
|
||||||
|
// ordering is improved.
|
||||||
fireDelete( new DeleteEvent( entityName, child, false, true, this ) );
|
fireDelete( new DeleteEvent( entityName, child, false, true, this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -904,23 +930,28 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
|
|
||||||
// load()/get() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// load()/get() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@Override
|
||||||
public void load(Object object, Serializable id) throws HibernateException {
|
public void load(Object object, Serializable id) throws HibernateException {
|
||||||
LoadEvent event = new LoadEvent(id, object, this);
|
LoadEvent event = new LoadEvent(id, object, this);
|
||||||
fireLoad( event, LoadEventListener.RELOAD );
|
fireLoad( event, LoadEventListener.RELOAD );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object load(Class entityClass, Serializable id) throws HibernateException {
|
public Object load(Class entityClass, Serializable id) throws HibernateException {
|
||||||
return this.byId( entityClass ).getReference( id );
|
return this.byId( entityClass ).getReference( id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object load(String entityName, Serializable id) throws HibernateException {
|
public Object load(String entityName, Serializable id) throws HibernateException {
|
||||||
return this.byId( entityName ).getReference( id );
|
return this.byId( entityName ).getReference( id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object get(Class entityClass, Serializable id) throws HibernateException {
|
public Object get(Class entityClass, Serializable id) throws HibernateException {
|
||||||
return this.byId( entityClass ).load( id );
|
return this.byId( entityClass ).load( id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object get(String entityName, Serializable id) throws HibernateException {
|
public Object get(String entityName, Serializable id) throws HibernateException {
|
||||||
return this.byId( entityName ).load( id );
|
return this.byId( entityName ).load( id );
|
||||||
}
|
}
|
||||||
|
@ -930,6 +961,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
* This is only called when lazily initializing a proxy.
|
* This is only called when lazily initializing a proxy.
|
||||||
* Do NOT return a proxy.
|
* Do NOT return a proxy.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object immediateLoad(String entityName, Serializable id) throws HibernateException {
|
public Object immediateLoad(String entityName, Serializable id) throws HibernateException {
|
||||||
if ( LOG.isDebugEnabled() ) {
|
if ( LOG.isDebugEnabled() ) {
|
||||||
EntityPersister persister = getFactory().getEntityPersister(entityName);
|
EntityPersister persister = getFactory().getEntityPersister(entityName);
|
||||||
|
@ -941,6 +973,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return event.getResult();
|
return event.getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object internalLoad(String entityName, Serializable id, boolean eager, boolean nullable) throws HibernateException {
|
public Object internalLoad(String entityName, Serializable id, boolean eager, boolean nullable) throws HibernateException {
|
||||||
// todo : remove
|
// todo : remove
|
||||||
LoadEventListener.LoadType type = nullable
|
LoadEventListener.LoadType type = nullable
|
||||||
|
@ -956,34 +989,42 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return event.getResult();
|
return event.getResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object load(Class entityClass, Serializable id, LockMode lockMode) throws HibernateException {
|
public Object load(Class entityClass, Serializable id, LockMode lockMode) throws HibernateException {
|
||||||
return this.byId( entityClass ).with( new LockOptions( lockMode ) ).getReference( id );
|
return this.byId( entityClass ).with( new LockOptions( lockMode ) ).getReference( id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object load(Class entityClass, Serializable id, LockOptions lockOptions) throws HibernateException {
|
public Object load(Class entityClass, Serializable id, LockOptions lockOptions) throws HibernateException {
|
||||||
return this.byId( entityClass ).with( lockOptions ).getReference( id );
|
return this.byId( entityClass ).with( lockOptions ).getReference( id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object load(String entityName, Serializable id, LockMode lockMode) throws HibernateException {
|
public Object load(String entityName, Serializable id, LockMode lockMode) throws HibernateException {
|
||||||
return this.byId( entityName ).with( new LockOptions( lockMode ) ).getReference( id );
|
return this.byId( entityName ).with( new LockOptions( lockMode ) ).getReference( id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object load(String entityName, Serializable id, LockOptions lockOptions) throws HibernateException {
|
public Object load(String entityName, Serializable id, LockOptions lockOptions) throws HibernateException {
|
||||||
return this.byId( entityName ).with( lockOptions ).getReference( id );
|
return this.byId( entityName ).with( lockOptions ).getReference( id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object get(Class entityClass, Serializable id, LockMode lockMode) throws HibernateException {
|
public Object get(Class entityClass, Serializable id, LockMode lockMode) throws HibernateException {
|
||||||
return this.byId( entityClass ).with( new LockOptions( lockMode ) ).load( id );
|
return this.byId( entityClass ).with( new LockOptions( lockMode ) ).load( id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object get(Class entityClass, Serializable id, LockOptions lockOptions) throws HibernateException {
|
public Object get(Class entityClass, Serializable id, LockOptions lockOptions) throws HibernateException {
|
||||||
return this.byId( entityClass ).with( lockOptions ).load( id );
|
return this.byId( entityClass ).with( lockOptions ).load( id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object get(String entityName, Serializable id, LockMode lockMode) throws HibernateException {
|
public Object get(String entityName, Serializable id, LockMode lockMode) throws HibernateException {
|
||||||
return this.byId( entityName ).with( new LockOptions( lockMode ) ).load( id );
|
return this.byId( entityName ).with( new LockOptions( lockMode ) ).load( id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object get(String entityName, Serializable id, LockOptions lockOptions) throws HibernateException {
|
public Object get(String entityName, Serializable id, LockOptions lockOptions) throws HibernateException {
|
||||||
return this.byId( entityName ).with( lockOptions ).load( id );
|
return this.byId( entityName ).with( lockOptions ).load( id );
|
||||||
}
|
}
|
||||||
|
@ -1039,6 +1080,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
|
|
||||||
// refresh() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// refresh() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@Override
|
||||||
public void refresh(Object object) throws HibernateException {
|
public void refresh(Object object) throws HibernateException {
|
||||||
refresh( null, object );
|
refresh( null, object );
|
||||||
}
|
}
|
||||||
|
@ -1048,18 +1090,22 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
fireRefresh( new RefreshEvent( entityName, object, this ) );
|
fireRefresh( new RefreshEvent( entityName, object, this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void refresh(Object object, LockMode lockMode) throws HibernateException {
|
public void refresh(Object object, LockMode lockMode) throws HibernateException {
|
||||||
fireRefresh( new RefreshEvent( object, lockMode, this ) );
|
fireRefresh( new RefreshEvent( object, lockMode, this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void refresh(Object object, LockOptions lockOptions) throws HibernateException {
|
public void refresh(Object object, LockOptions lockOptions) throws HibernateException {
|
||||||
refresh( null, object, lockOptions );
|
refresh( null, object, lockOptions );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refresh(String entityName, Object object, LockOptions lockOptions) throws HibernateException {
|
public void refresh(String entityName, Object object, LockOptions lockOptions) throws HibernateException {
|
||||||
fireRefresh( new RefreshEvent( entityName, object, lockOptions, this ) );
|
fireRefresh( new RefreshEvent( entityName, object, lockOptions, this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void refresh(String entityName, Object object, Map refreshedAlready) throws HibernateException {
|
public void refresh(String entityName, Object object, Map refreshedAlready) throws HibernateException {
|
||||||
fireRefresh( refreshedAlready, new RefreshEvent( entityName, object, this ) );
|
fireRefresh( refreshedAlready, new RefreshEvent( entityName, object, this ) );
|
||||||
}
|
}
|
||||||
|
@ -1085,10 +1131,12 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
|
|
||||||
// replicate() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// replicate() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@Override
|
||||||
public void replicate(Object obj, ReplicationMode replicationMode) throws HibernateException {
|
public void replicate(Object obj, ReplicationMode replicationMode) throws HibernateException {
|
||||||
fireReplicate( new ReplicateEvent( obj, replicationMode, this ) );
|
fireReplicate( new ReplicateEvent( obj, replicationMode, this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void replicate(String entityName, Object obj, ReplicationMode replicationMode)
|
public void replicate(String entityName, Object obj, ReplicationMode replicationMode)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
fireReplicate( new ReplicateEvent( entityName, obj, replicationMode, this ) );
|
fireReplicate( new ReplicateEvent( entityName, obj, replicationMode, this ) );
|
||||||
|
@ -1110,6 +1158,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
* remove any hard references to the entity that are held by the infrastructure
|
* remove any hard references to the entity that are held by the infrastructure
|
||||||
* (references held by application or other persistent instances are okay)
|
* (references held by application or other persistent instances are okay)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void evict(Object object) throws HibernateException {
|
public void evict(Object object) throws HibernateException {
|
||||||
fireEvict( new EvictEvent( object, this ) );
|
fireEvict( new EvictEvent( object, this ) );
|
||||||
}
|
}
|
||||||
|
@ -1140,6 +1189,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return event.isFlushRequired();
|
return event.isFlushRequired();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isDirty() throws HibernateException {
|
public boolean isDirty() throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
|
@ -1156,6 +1206,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return event.isDirty();
|
return event.isDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void flush() throws HibernateException {
|
public void flush() throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
|
@ -1169,6 +1220,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
delayedAfterCompletion();
|
delayedAfterCompletion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void forceFlush(EntityEntry entityEntry) throws HibernateException {
|
public void forceFlush(EntityEntry entityEntry) throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
if ( LOG.isDebugEnabled() ) {
|
if ( LOG.isDebugEnabled() ) {
|
||||||
|
@ -1187,6 +1239,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List list(String query, QueryParameters queryParameters) throws HibernateException {
|
public List list(String query, QueryParameters queryParameters) throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
|
@ -1215,6 +1268,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int executeUpdate(String query, QueryParameters queryParameters) throws HibernateException {
|
public int executeUpdate(String query, QueryParameters queryParameters) throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
|
@ -1235,6 +1289,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int executeNativeUpdate(NativeSQLQuerySpecification nativeQuerySpecification,
|
public int executeNativeUpdate(NativeSQLQuerySpecification nativeQuerySpecification,
|
||||||
QueryParameters queryParameters) throws HibernateException {
|
QueryParameters queryParameters) throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
|
@ -1257,6 +1312,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Iterator iterate(String query, QueryParameters queryParameters) throws HibernateException {
|
public Iterator iterate(String query, QueryParameters queryParameters) throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
|
@ -1274,6 +1330,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ScrollableResults scroll(String query, QueryParameters queryParameters) throws HibernateException {
|
public ScrollableResults scroll(String query, QueryParameters queryParameters) throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
|
@ -1289,6 +1346,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Query createFilter(Object collection, String queryString) {
|
public Query createFilter(Object collection, String queryString) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
|
@ -1303,6 +1361,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return filter;
|
return filter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Query getNamedQuery(String queryName) throws MappingException {
|
public Query getNamedQuery(String queryName) throws MappingException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
|
@ -1311,6 +1370,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return query;
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object instantiate(String entityName, Serializable id) throws HibernateException {
|
public Object instantiate(String entityName, Serializable id) throws HibernateException {
|
||||||
return instantiate( factory.getEntityPersister( entityName ), id );
|
return instantiate( factory.getEntityPersister( entityName ), id );
|
||||||
}
|
}
|
||||||
|
@ -1318,6 +1378,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
/**
|
/**
|
||||||
* give the interceptor an opportunity to override the default instantiation
|
* give the interceptor an opportunity to override the default instantiation
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object instantiate(EntityPersister persister, Serializable id) throws HibernateException {
|
public Object instantiate(EntityPersister persister, Serializable id) throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
|
@ -1329,6 +1390,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setFlushMode(FlushMode flushMode) {
|
public void setFlushMode(FlushMode flushMode) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
|
@ -1336,16 +1398,19 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
this.flushMode = flushMode;
|
this.flushMode = flushMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public FlushMode getFlushMode() {
|
public FlushMode getFlushMode() {
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return flushMode;
|
return flushMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CacheMode getCacheMode() {
|
public CacheMode getCacheMode() {
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return cacheMode;
|
return cacheMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setCacheMode(CacheMode cacheMode) {
|
public void setCacheMode(CacheMode cacheMode) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
|
@ -1353,11 +1418,13 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
this.cacheMode= cacheMode;
|
this.cacheMode= cacheMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Transaction getTransaction() throws HibernateException {
|
public Transaction getTransaction() throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
return transactionCoordinator.getTransaction();
|
return transactionCoordinator.getTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Transaction beginTransaction() throws HibernateException {
|
public Transaction beginTransaction() throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
Transaction result = getTransaction();
|
Transaction result = getTransaction();
|
||||||
|
@ -1365,6 +1432,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityPersister getEntityPersister(final String entityName, final Object object) {
|
public EntityPersister getEntityPersister(final String entityName, final Object object) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
if (entityName==null) {
|
if (entityName==null) {
|
||||||
|
@ -1391,6 +1459,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
}
|
}
|
||||||
|
|
||||||
// not for internal use:
|
// not for internal use:
|
||||||
|
@Override
|
||||||
public Serializable getIdentifier(Object object) throws HibernateException {
|
public Serializable getIdentifier(Object object) throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
|
@ -1414,6 +1483,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
* Get the id value for an object that is actually associated with the session. This
|
* Get the id value for an object that is actually associated with the session. This
|
||||||
* is a bit stricter than getEntityIdentifierIfNotUnsaved().
|
* is a bit stricter than getEntityIdentifierIfNotUnsaved().
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Serializable getContextEntityIdentifier(Object object) {
|
public Serializable getContextEntityIdentifier(Object object) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
if ( object instanceof HibernateProxy ) {
|
if ( object instanceof HibernateProxy ) {
|
||||||
|
@ -1479,6 +1549,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return plan;
|
return plan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List listFilter(Object collection, String filter, QueryParameters queryParameters)
|
public List listFilter(Object collection, String filter, QueryParameters queryParameters)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
|
@ -1500,6 +1571,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Iterator iterateFilter(Object collection, String filter, QueryParameters queryParameters)
|
public Iterator iterateFilter(Object collection, String filter, QueryParameters queryParameters)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
|
@ -1510,30 +1582,35 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return itr;
|
return itr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Criteria createCriteria(Class persistentClass, String alias) {
|
public Criteria createCriteria(Class persistentClass, String alias) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return new CriteriaImpl( persistentClass.getName(), alias, this );
|
return new CriteriaImpl( persistentClass.getName(), alias, this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Criteria createCriteria(String entityName, String alias) {
|
public Criteria createCriteria(String entityName, String alias) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return new CriteriaImpl(entityName, alias, this);
|
return new CriteriaImpl(entityName, alias, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Criteria createCriteria(Class persistentClass) {
|
public Criteria createCriteria(Class persistentClass) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return new CriteriaImpl( persistentClass.getName(), this );
|
return new CriteriaImpl( persistentClass.getName(), this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Criteria createCriteria(String entityName) {
|
public Criteria createCriteria(String entityName) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return new CriteriaImpl(entityName, this);
|
return new CriteriaImpl(entityName, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ScrollableResults scroll(Criteria criteria, ScrollMode scrollMode) {
|
public ScrollableResults scroll(Criteria criteria, ScrollMode scrollMode) {
|
||||||
// TODO: Is this guaranteed to always be CriteriaImpl?
|
// TODO: Is this guaranteed to always be CriteriaImpl?
|
||||||
CriteriaImpl criteriaImpl = (CriteriaImpl) criteria;
|
CriteriaImpl criteriaImpl = (CriteriaImpl) criteria;
|
||||||
|
@ -1559,6 +1636,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public List list(Criteria criteria) throws HibernateException {
|
public List list(Criteria criteria) throws HibernateException {
|
||||||
// TODO: Is this guaranteed to always be CriteriaImpl?
|
// TODO: Is this guaranteed to always be CriteriaImpl?
|
||||||
CriteriaImpl criteriaImpl = (CriteriaImpl) criteria;
|
CriteriaImpl criteriaImpl = (CriteriaImpl) criteria;
|
||||||
|
@ -1680,6 +1758,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return ( OuterJoinLoadable ) persister;
|
return ( OuterJoinLoadable ) persister;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean contains(Object object) {
|
public boolean contains(Object object) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
|
@ -1710,12 +1789,14 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return entry != null && entry.getStatus() != Status.DELETED && entry.getStatus() != Status.GONE;
|
return entry != null && entry.getStatus() != Status.DELETED && entry.getStatus() != Status.GONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Query createQuery(String queryString) {
|
public Query createQuery(String queryString) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return super.createQuery( queryString );
|
return super.createQuery( queryString );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public SQLQuery createSQLQuery(String sql) {
|
public SQLQuery createSQLQuery(String sql) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
|
@ -1743,6 +1824,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return super.createStoredProcedureCall( procedureName, resultClasses );
|
return super.createStoredProcedureCall( procedureName, resultClasses );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
|
public ScrollableResults scrollCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
|
@ -1767,6 +1849,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
}
|
}
|
||||||
|
|
||||||
// basically just an adapted copy of find(CriteriaImpl)
|
// basically just an adapted copy of find(CriteriaImpl)
|
||||||
|
@Override
|
||||||
public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
|
public List listCustomQuery(CustomQuery customQuery, QueryParameters queryParameters)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
|
@ -1794,11 +1877,13 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public SessionFactoryImplementor getSessionFactory() {
|
public SessionFactoryImplementor getSessionFactory() {
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void initializeCollection(PersistentCollection collection, boolean writing)
|
public void initializeCollection(PersistentCollection collection, boolean writing)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
|
@ -1810,6 +1895,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
delayedAfterCompletion();
|
delayedAfterCompletion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String bestGuessEntityName(Object object) {
|
public String bestGuessEntityName(Object object) {
|
||||||
if (object instanceof HibernateProxy) {
|
if (object instanceof HibernateProxy) {
|
||||||
LazyInitializer initializer = ( ( HibernateProxy ) object ).getHibernateLazyInitializer();
|
LazyInitializer initializer = ( ( HibernateProxy ) object ).getHibernateLazyInitializer();
|
||||||
|
@ -1829,6 +1915,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getEntityName(Object object) {
|
public String getEntityName(Object object) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
|
@ -1853,25 +1940,30 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String guessEntityName(Object object) throws HibernateException {
|
public String guessEntityName(Object object) throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
return entityNameResolver.resolveEntityName( object );
|
return entityNameResolver.resolveEntityName( object );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void cancelQuery() throws HibernateException {
|
public void cancelQuery() throws HibernateException {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
getTransactionCoordinator().getJdbcCoordinator().cancelLastQuery();
|
getTransactionCoordinator().getJdbcCoordinator().cancelLastQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Interceptor getInterceptor() {
|
public Interceptor getInterceptor() {
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return interceptor;
|
return interceptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getDontFlushFromFind() {
|
public int getDontFlushFromFind() {
|
||||||
return dontFlushFromFind;
|
return dontFlushFromFind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder buf = new StringBuilder(500)
|
StringBuilder buf = new StringBuilder(500)
|
||||||
.append( "SessionImpl(" );
|
.append( "SessionImpl(" );
|
||||||
|
@ -1886,54 +1978,57 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return buf.append(')').toString();
|
return buf.append(')').toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ActionQueue getActionQueue() {
|
public ActionQueue getActionQueue() {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return actionQueue;
|
return actionQueue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PersistenceContext getPersistenceContext() {
|
public PersistenceContext getPersistenceContext() {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return persistenceContext;
|
return persistenceContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public SessionStatistics getStatistics() {
|
public SessionStatistics getStatistics() {
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return new SessionStatisticsImpl(this);
|
return new SessionStatisticsImpl(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isEventSource() {
|
public boolean isEventSource() {
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isDefaultReadOnly() {
|
public boolean isDefaultReadOnly() {
|
||||||
return persistenceContext.isDefaultReadOnly();
|
return persistenceContext.isDefaultReadOnly();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void setDefaultReadOnly(boolean defaultReadOnly) {
|
public void setDefaultReadOnly(boolean defaultReadOnly) {
|
||||||
persistenceContext.setDefaultReadOnly( defaultReadOnly );
|
persistenceContext.setDefaultReadOnly( defaultReadOnly );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isReadOnly(Object entityOrProxy) {
|
public boolean isReadOnly(Object entityOrProxy) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return persistenceContext.isReadOnly( entityOrProxy );
|
return persistenceContext.isReadOnly( entityOrProxy );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setReadOnly(Object entity, boolean readOnly) {
|
public void setReadOnly(Object entity, boolean readOnly) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
persistenceContext.setReadOnly( entity, readOnly );
|
persistenceContext.setReadOnly( entity, readOnly );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void doWork(final Work work) throws HibernateException {
|
public void doWork(final Work work) throws HibernateException {
|
||||||
WorkExecutorVisitable<Void> realWork = new WorkExecutorVisitable<Void>() {
|
WorkExecutorVisitable<Void> realWork = new WorkExecutorVisitable<Void>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1945,6 +2040,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
doWork( realWork );
|
doWork( realWork );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public <T> T doReturningWork(final ReturningWork<T> work) throws HibernateException {
|
public <T> T doReturningWork(final ReturningWork<T> work) throws HibernateException {
|
||||||
WorkExecutorVisitable<T> realWork = new WorkExecutorVisitable<T>() {
|
WorkExecutorVisitable<T> realWork = new WorkExecutorVisitable<T>() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -1959,6 +2055,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return transactionCoordinator.getJdbcCoordinator().coordinateWork( work );
|
return transactionCoordinator.getJdbcCoordinator().coordinateWork( work );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void afterScrollOperation() {
|
public void afterScrollOperation() {
|
||||||
// nothing to do in a stateful session
|
// nothing to do in a stateful session
|
||||||
}
|
}
|
||||||
|
@ -1969,59 +2066,48 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
return transactionCoordinator;
|
return transactionCoordinator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public LoadQueryInfluencers getLoadQueryInfluencers() {
|
public LoadQueryInfluencers getLoadQueryInfluencers() {
|
||||||
return loadQueryInfluencers;
|
return loadQueryInfluencers;
|
||||||
}
|
}
|
||||||
|
|
||||||
// filter support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// filter support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Filter getEnabledFilter(String filterName) {
|
public Filter getEnabledFilter(String filterName) {
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return loadQueryInfluencers.getEnabledFilter( filterName );
|
return loadQueryInfluencers.getEnabledFilter( filterName );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Filter enableFilter(String filterName) {
|
public Filter enableFilter(String filterName) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return loadQueryInfluencers.enableFilter( filterName );
|
return loadQueryInfluencers.enableFilter( filterName );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void disableFilter(String filterName) {
|
public void disableFilter(String filterName) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
loadQueryInfluencers.disableFilter( filterName );
|
loadQueryInfluencers.disableFilter( filterName );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object getFilterParameterValue(String filterParameterName) {
|
public Object getFilterParameterValue(String filterParameterName) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return loadQueryInfluencers.getFilterParameterValue( filterParameterName );
|
return loadQueryInfluencers.getFilterParameterValue( filterParameterName );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Type getFilterParameterType(String filterParameterName) {
|
public Type getFilterParameterType(String filterParameterName) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return loadQueryInfluencers.getFilterParameterType( filterParameterName );
|
return loadQueryInfluencers.getFilterParameterType( filterParameterName );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Map getEnabledFilters() {
|
public Map getEnabledFilters() {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
|
@ -2031,17 +2117,13 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
|
|
||||||
// internal fetch profile support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// internal fetch profile support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getFetchProfile() {
|
public String getFetchProfile() {
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
return loadQueryInfluencers.getInternalFetchProfile();
|
return loadQueryInfluencers.getInternalFetchProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void setFetchProfile(String fetchProfile) {
|
public void setFetchProfile(String fetchProfile) {
|
||||||
errorIfClosed();
|
errorIfClosed();
|
||||||
checkTransactionSynchStatus();
|
checkTransactionSynchStatus();
|
||||||
|
@ -2051,14 +2133,17 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
|
|
||||||
// fetch profile support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// fetch profile support ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isFetchProfileEnabled(String name) throws UnknownProfileException {
|
public boolean isFetchProfileEnabled(String name) throws UnknownProfileException {
|
||||||
return loadQueryInfluencers.isFetchProfileEnabled( name );
|
return loadQueryInfluencers.isFetchProfileEnabled( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void enableFetchProfile(String name) throws UnknownProfileException {
|
public void enableFetchProfile(String name) throws UnknownProfileException {
|
||||||
loadQueryInfluencers.enableFetchProfile( name );
|
loadQueryInfluencers.enableFetchProfile( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void disableFetchProfile(String name) throws UnknownProfileException {
|
public void disableFetchProfile(String name) throws UnknownProfileException {
|
||||||
loadQueryInfluencers.disableFetchProfile( name );
|
loadQueryInfluencers.disableFetchProfile( name );
|
||||||
}
|
}
|
||||||
|
@ -2152,9 +2237,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
oos.writeObject( loadQueryInfluencers );
|
oos.writeObject( loadQueryInfluencers );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public TypeHelper getTypeHelper() {
|
public TypeHelper getTypeHelper() {
|
||||||
return getSessionFactory().getTypeHelper();
|
return getSessionFactory().getTypeHelper();
|
||||||
}
|
}
|
||||||
|
@ -2324,6 +2407,7 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CoordinatingEntityNameResolver implements EntityNameResolver {
|
private class CoordinatingEntityNameResolver implements EntityNameResolver {
|
||||||
|
@Override
|
||||||
public String resolveEntityName(Object entity) {
|
public String resolveEntityName(Object entity) {
|
||||||
String entityName = interceptor.getEntityName( entity );
|
String entityName = interceptor.getEntityName( entity );
|
||||||
if ( entityName != null ) {
|
if ( entityName != null ) {
|
||||||
|
@ -2353,36 +2437,45 @@ public final class SessionImpl extends AbstractSessionImpl implements EventSourc
|
||||||
LockOptions.copy(lo, lockOptions);
|
LockOptions.copy(lo, lockOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public LockMode getLockMode() {
|
public LockMode getLockMode() {
|
||||||
return lockOptions.getLockMode();
|
return lockOptions.getLockMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public LockRequest setLockMode(LockMode lockMode) {
|
public LockRequest setLockMode(LockMode lockMode) {
|
||||||
lockOptions.setLockMode(lockMode);
|
lockOptions.setLockMode(lockMode);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getTimeOut() {
|
public int getTimeOut() {
|
||||||
return lockOptions.getTimeOut();
|
return lockOptions.getTimeOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public LockRequest setTimeOut(int timeout) {
|
public LockRequest setTimeOut(int timeout) {
|
||||||
lockOptions.setTimeOut(timeout);
|
lockOptions.setTimeOut(timeout);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean getScope() {
|
public boolean getScope() {
|
||||||
return lockOptions.getScope();
|
return lockOptions.getScope();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public LockRequest setScope(boolean scope) {
|
public LockRequest setScope(boolean scope) {
|
||||||
lockOptions.setScope(scope);
|
lockOptions.setScope(scope);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void lock(String entityName, Object object) throws HibernateException {
|
public void lock(String entityName, Object object) throws HibernateException {
|
||||||
fireLock( entityName, object, lockOptions );
|
fireLock( entityName, object, lockOptions );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void lock(Object object) throws HibernateException {
|
public void lock(Object object) throws HibernateException {
|
||||||
fireLock( object, lockOptions );
|
fireLock( object, lockOptions );
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,16 +45,12 @@ public class TypeLocatorImpl implements TypeHelper, Serializable {
|
||||||
this.typeResolver = typeResolver;
|
this.typeResolver = typeResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public BasicType basic(String name) {
|
public BasicType basic(String name) {
|
||||||
return typeResolver.basic( name );
|
return typeResolver.basic( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public BasicType basic(Class javaType) {
|
public BasicType basic(Class javaType) {
|
||||||
BasicType type = typeResolver.basic( javaType.getName() );
|
BasicType type = typeResolver.basic( javaType.getName() );
|
||||||
if ( type == null ) {
|
if ( type == null ) {
|
||||||
|
@ -134,38 +130,28 @@ public class TypeLocatorImpl implements TypeHelper, Serializable {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Type heuristicType(String name) {
|
public Type heuristicType(String name) {
|
||||||
return typeResolver.heuristicType( name );
|
return typeResolver.heuristicType( name );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Type entity(Class entityClass) {
|
public Type entity(Class entityClass) {
|
||||||
return entity( entityClass.getName() );
|
return entity( entityClass.getName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Type entity(String entityName) {
|
public Type entity(String entityName) {
|
||||||
return typeResolver.getTypeFactory().manyToOne( entityName );
|
return typeResolver.getTypeFactory().manyToOne( entityName );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
public Type custom(Class userTypeClass) {
|
public Type custom(Class userTypeClass) {
|
||||||
return custom( userTypeClass, null );
|
return custom( userTypeClass, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
public Type custom(Class userTypeClass, Properties parameters) {
|
public Type custom(Class userTypeClass, Properties parameters) {
|
||||||
if ( CompositeUserType.class.isAssignableFrom( userTypeClass ) ) {
|
if ( CompositeUserType.class.isAssignableFrom( userTypeClass ) ) {
|
||||||
|
@ -176,9 +162,7 @@ public class TypeLocatorImpl implements TypeHelper, Serializable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Type any(Type metaType, Type identifierType) {
|
public Type any(Type metaType, Type identifierType) {
|
||||||
return typeResolver.getTypeFactory().any( metaType, identifierType );
|
return typeResolver.getTypeFactory().any( metaType, identifierType );
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,10 +319,12 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final int keyHash() {
|
public final int keyHash() {
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final Object keyRef() {
|
public final Object keyRef() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -339,10 +341,12 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final int keyHash() {
|
public final int keyHash() {
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final Object keyRef() {
|
public final Object keyRef() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -358,10 +362,12 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final int keyHash() {
|
public final int keyHash() {
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final Object keyRef() {
|
public final Object keyRef() {
|
||||||
return keyRef;
|
return keyRef;
|
||||||
}
|
}
|
||||||
|
@ -377,10 +383,12 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
this.hash = hash;
|
this.hash = hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final int keyHash() {
|
public final int keyHash() {
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final Object keyRef() {
|
public final Object keyRef() {
|
||||||
return keyRef;
|
return keyRef;
|
||||||
}
|
}
|
||||||
|
@ -1095,6 +1103,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
*
|
*
|
||||||
* @return <tt>true</tt> if this map contains no key-value mappings
|
* @return <tt>true</tt> if this map contains no key-value mappings
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
final Segment<K, V>[] segments = this.segments;
|
final Segment<K, V>[] segments = this.segments;
|
||||||
/*
|
/*
|
||||||
|
@ -1137,6 +1146,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
*
|
*
|
||||||
* @return the number of key-value mappings in this map
|
* @return the number of key-value mappings in this map
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
final Segment<K, V>[] segments = this.segments;
|
final Segment<K, V>[] segments = this.segments;
|
||||||
long sum = 0;
|
long sum = 0;
|
||||||
|
@ -1196,6 +1206,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
*
|
*
|
||||||
* @throws NullPointerException if the specified key is null
|
* @throws NullPointerException if the specified key is null
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public V get(Object key) {
|
public V get(Object key) {
|
||||||
if ( key == null ) {
|
if ( key == null ) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -1215,6 +1226,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
*
|
*
|
||||||
* @throws NullPointerException if the specified key is null
|
* @throws NullPointerException if the specified key is null
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean containsKey(Object key) {
|
public boolean containsKey(Object key) {
|
||||||
if ( key == null ) {
|
if ( key == null ) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1234,6 +1246,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
* @return <tt>true</tt> if this map maps one or more keys to the
|
* @return <tt>true</tt> if this map maps one or more keys to the
|
||||||
* specified value
|
* specified value
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean containsValue(Object value) {
|
public boolean containsValue(Object value) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1326,6 +1339,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
*
|
*
|
||||||
* @throws NullPointerException if the specified key or value is null
|
* @throws NullPointerException if the specified key or value is null
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public V put(K key, V value) {
|
public V put(K key, V value) {
|
||||||
if ( key == null || value == null ) {
|
if ( key == null || value == null ) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -1342,6 +1356,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
*
|
*
|
||||||
* @throws NullPointerException if the specified key or value is null
|
* @throws NullPointerException if the specified key or value is null
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public V putIfAbsent(K key, V value) {
|
public V putIfAbsent(K key, V value) {
|
||||||
if ( key == null || value == null ) {
|
if ( key == null || value == null ) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -1357,6 +1372,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
*
|
*
|
||||||
* @param m mappings to be stored in this map
|
* @param m mappings to be stored in this map
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void putAll(Map<? extends K, ? extends V> m) {
|
public void putAll(Map<? extends K, ? extends V> m) {
|
||||||
for ( Map.Entry<? extends K, ? extends V> e : m.entrySet() ) {
|
for ( Map.Entry<? extends K, ? extends V> e : m.entrySet() ) {
|
||||||
put( e.getKey(), e.getValue() );
|
put( e.getKey(), e.getValue() );
|
||||||
|
@ -1374,6 +1390,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
*
|
*
|
||||||
* @throws NullPointerException if the specified key is null
|
* @throws NullPointerException if the specified key is null
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public V remove(Object key) {
|
public V remove(Object key) {
|
||||||
if ( key == null ) {
|
if ( key == null ) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -1387,6 +1404,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
*
|
*
|
||||||
* @throws NullPointerException if the specified key is null
|
* @throws NullPointerException if the specified key is null
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean remove(Object key, Object value) {
|
public boolean remove(Object key, Object value) {
|
||||||
if ( key == null || value == null ) {
|
if ( key == null || value == null ) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1400,6 +1418,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
*
|
*
|
||||||
* @throws NullPointerException if any of the arguments are null
|
* @throws NullPointerException if any of the arguments are null
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean replace(K key, V oldValue, V newValue) {
|
public boolean replace(K key, V oldValue, V newValue) {
|
||||||
if ( key == null || oldValue == null || newValue == null ) {
|
if ( key == null || oldValue == null || newValue == null ) {
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
|
@ -1416,6 +1435,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
*
|
*
|
||||||
* @throws NullPointerException if the specified key or value is null
|
* @throws NullPointerException if the specified key or value is null
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public V replace(K key, V value) {
|
public V replace(K key, V value) {
|
||||||
if ( key == null || value == null ) {
|
if ( key == null || value == null ) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -1427,6 +1447,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
/**
|
/**
|
||||||
* Removes all of the mappings from this map.
|
* Removes all of the mappings from this map.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
for ( int i = 0; i < segments.length; ++i ) {
|
for ( int i = 0; i < segments.length; ++i ) {
|
||||||
segments[i].clear();
|
segments[i].clear();
|
||||||
|
@ -1467,6 +1488,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
* construction of the iterator, and may (but is not guaranteed to)
|
* construction of the iterator, and may (but is not guaranteed to)
|
||||||
* reflect any modifications subsequent to construction.
|
* reflect any modifications subsequent to construction.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Set<K> keySet() {
|
public Set<K> keySet() {
|
||||||
Set<K> ks = keySet;
|
Set<K> ks = keySet;
|
||||||
return ( ks != null ) ? ks : ( keySet = new KeySet() );
|
return ( ks != null ) ? ks : ( keySet = new KeySet() );
|
||||||
|
@ -1488,6 +1510,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
* construction of the iterator, and may (but is not guaranteed to)
|
* construction of the iterator, and may (but is not guaranteed to)
|
||||||
* reflect any modifications subsequent to construction.
|
* reflect any modifications subsequent to construction.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Collection<V> values() {
|
public Collection<V> values() {
|
||||||
Collection<V> vs = values;
|
Collection<V> vs = values;
|
||||||
return ( vs != null ) ? vs : ( values = new Values() );
|
return ( vs != null ) ? vs : ( values = new Values() );
|
||||||
|
@ -1509,6 +1532,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
* construction of the iterator, and may (but is not guaranteed to)
|
* construction of the iterator, and may (but is not guaranteed to)
|
||||||
* reflect any modifications subsequent to construction.
|
* reflect any modifications subsequent to construction.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Set<Map.Entry<K, V>> entrySet() {
|
public Set<Map.Entry<K, V>> entrySet() {
|
||||||
Set<Map.Entry<K, V>> es = entrySet;
|
Set<Map.Entry<K, V>> es = entrySet;
|
||||||
return ( es != null ) ? es : ( entrySet = new EntrySet() );
|
return ( es != null ) ? es : ( entrySet = new EntrySet() );
|
||||||
|
@ -1618,10 +1642,12 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
final class KeyIterator
|
final class KeyIterator
|
||||||
extends HashIterator
|
extends HashIterator
|
||||||
implements Iterator<K>, Enumeration<K> {
|
implements Iterator<K>, Enumeration<K> {
|
||||||
|
@Override
|
||||||
public K next() {
|
public K next() {
|
||||||
return super.nextEntry().key();
|
return super.nextEntry().key();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public K nextElement() {
|
public K nextElement() {
|
||||||
return super.nextEntry().key();
|
return super.nextEntry().key();
|
||||||
}
|
}
|
||||||
|
@ -1630,10 +1656,12 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
final class ValueIterator
|
final class ValueIterator
|
||||||
extends HashIterator
|
extends HashIterator
|
||||||
implements Iterator<V>, Enumeration<V> {
|
implements Iterator<V>, Enumeration<V> {
|
||||||
|
@Override
|
||||||
public V next() {
|
public V next() {
|
||||||
return super.nextEntry().value();
|
return super.nextEntry().value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public V nextElement() {
|
public V nextElement() {
|
||||||
return super.nextEntry().value();
|
return super.nextEntry().value();
|
||||||
}
|
}
|
||||||
|
@ -1659,20 +1687,24 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
this.value = entry.getValue();
|
this.value = entry.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public K getKey() {
|
public K getKey() {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public V getValue() {
|
public V getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public V setValue(V value) {
|
public V setValue(V value) {
|
||||||
V oldValue = this.value;
|
V oldValue = this.value;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
return oldValue;
|
return oldValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if ( !( o instanceof Map.Entry ) ) {
|
if ( !( o instanceof Map.Entry ) ) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1682,11 +1714,13 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
return eq( key, e.getKey() ) && eq( value, e.getValue() );
|
return eq( key, e.getKey() ) && eq( value, e.getValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return ( key == null ? 0 : key.hashCode() )
|
return ( key == null ? 0 : key.hashCode() )
|
||||||
^ ( value == null ? 0 : value.hashCode() );
|
^ ( value == null ? 0 : value.hashCode() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return key + "=" + value;
|
return key + "=" + value;
|
||||||
}
|
}
|
||||||
|
@ -1717,6 +1751,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
* removed in which case the put will re-establish). We do not
|
* removed in which case the put will re-establish). We do not
|
||||||
* and cannot guarantee more.
|
* and cannot guarantee more.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public V setValue(V value) {
|
public V setValue(V value) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
throw new NullPointerException();
|
throw new NullPointerException();
|
||||||
|
@ -1730,6 +1765,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
final class EntryIterator
|
final class EntryIterator
|
||||||
extends HashIterator
|
extends HashIterator
|
||||||
implements Iterator<Entry<K, V>> {
|
implements Iterator<Entry<K, V>> {
|
||||||
|
@Override
|
||||||
public Map.Entry<K, V> next() {
|
public Map.Entry<K, V> next() {
|
||||||
HashEntry<K, V> e = super.nextEntry();
|
HashEntry<K, V> e = super.nextEntry();
|
||||||
return new WriteThroughEntry( e.key(), e.value() );
|
return new WriteThroughEntry( e.key(), e.value() );
|
||||||
|
@ -1737,58 +1773,71 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
}
|
}
|
||||||
|
|
||||||
final class KeySet extends AbstractSet<K> {
|
final class KeySet extends AbstractSet<K> {
|
||||||
|
@Override
|
||||||
public Iterator<K> iterator() {
|
public Iterator<K> iterator() {
|
||||||
return new KeyIterator();
|
return new KeyIterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
return ConcurrentReferenceHashMap.this.size();
|
return ConcurrentReferenceHashMap.this.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
return ConcurrentReferenceHashMap.this.isEmpty();
|
return ConcurrentReferenceHashMap.this.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean contains(Object o) {
|
public boolean contains(Object o) {
|
||||||
return ConcurrentReferenceHashMap.this.containsKey( o );
|
return ConcurrentReferenceHashMap.this.containsKey( o );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean remove(Object o) {
|
public boolean remove(Object o) {
|
||||||
return ConcurrentReferenceHashMap.this.remove( o ) != null;
|
return ConcurrentReferenceHashMap.this.remove( o ) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
ConcurrentReferenceHashMap.this.clear();
|
ConcurrentReferenceHashMap.this.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final class Values extends AbstractCollection<V> {
|
final class Values extends AbstractCollection<V> {
|
||||||
|
@Override
|
||||||
public Iterator<V> iterator() {
|
public Iterator<V> iterator() {
|
||||||
return new ValueIterator();
|
return new ValueIterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
return ConcurrentReferenceHashMap.this.size();
|
return ConcurrentReferenceHashMap.this.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
return ConcurrentReferenceHashMap.this.isEmpty();
|
return ConcurrentReferenceHashMap.this.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean contains(Object o) {
|
public boolean contains(Object o) {
|
||||||
return ConcurrentReferenceHashMap.this.containsValue( o );
|
return ConcurrentReferenceHashMap.this.containsValue( o );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
ConcurrentReferenceHashMap.this.clear();
|
ConcurrentReferenceHashMap.this.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final class EntrySet extends AbstractSet<Map.Entry<K, V>> {
|
final class EntrySet extends AbstractSet<Map.Entry<K, V>> {
|
||||||
|
@Override
|
||||||
public Iterator<Map.Entry<K, V>> iterator() {
|
public Iterator<Map.Entry<K, V>> iterator() {
|
||||||
return new EntryIterator();
|
return new EntryIterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean contains(Object o) {
|
public boolean contains(Object o) {
|
||||||
if ( !( o instanceof Map.Entry ) ) {
|
if ( !( o instanceof Map.Entry ) ) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1798,6 +1847,7 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
return v != null && v.equals( e.getValue() );
|
return v != null && v.equals( e.getValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean remove(Object o) {
|
public boolean remove(Object o) {
|
||||||
if ( !( o instanceof Map.Entry ) ) {
|
if ( !( o instanceof Map.Entry ) ) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1806,14 +1856,17 @@ public class ConcurrentReferenceHashMap<K, V> extends AbstractMap<K, V>
|
||||||
return ConcurrentReferenceHashMap.this.remove( e.getKey(), e.getValue() );
|
return ConcurrentReferenceHashMap.this.remove( e.getKey(), e.getValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
return ConcurrentReferenceHashMap.this.size();
|
return ConcurrentReferenceHashMap.this.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
return ConcurrentReferenceHashMap.this.isEmpty();
|
return ConcurrentReferenceHashMap.this.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
ConcurrentReferenceHashMap.this.clear();
|
ConcurrentReferenceHashMap.this.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,16 +39,12 @@ public class OriginImpl implements Origin, Serializable {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getType() {
|
public String getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,16 +45,12 @@ public class XmlDocumentImpl implements XmlDocument, Serializable {
|
||||||
this.origin = origin;
|
this.origin = origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Document getDocumentTree() {
|
public Document getDocumentTree() {
|
||||||
return documentTree;
|
return documentTree;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Origin getOrigin() {
|
public Origin getOrigin() {
|
||||||
return origin;
|
return origin;
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,9 +136,7 @@ public class DefaultEntityAliases implements EntityAliases {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String[][] getSuffixedPropertyAliases(Loadable persister) {
|
public String[][] getSuffixedPropertyAliases(Loadable persister) {
|
||||||
final int size = persister.getPropertyNames().length;
|
final int size = persister.getPropertyNames().length;
|
||||||
final String[][] suffixedPropertyAliases = new String[size][];
|
final String[][] suffixedPropertyAliases = new String[size][];
|
||||||
|
@ -153,37 +151,27 @@ public class DefaultEntityAliases implements EntityAliases {
|
||||||
return suffixedPropertyAliases;
|
return suffixedPropertyAliases;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String[] getSuffixedVersionAliases() {
|
public String[] getSuffixedVersionAliases() {
|
||||||
return suffixedVersionColumn;
|
return suffixedVersionColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String[][] getSuffixedPropertyAliases() {
|
public String[][] getSuffixedPropertyAliases() {
|
||||||
return suffixedPropertyColumns;
|
return suffixedPropertyColumns;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getSuffixedDiscriminatorAlias() {
|
public String getSuffixedDiscriminatorAlias() {
|
||||||
return suffixedDiscriminatorColumn;
|
return suffixedDiscriminatorColumn;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String[] getSuffixedKeyAliases() {
|
public String[] getSuffixedKeyAliases() {
|
||||||
return suffixedKeyColumns;
|
return suffixedKeyColumns;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getRowIdAlias() {
|
public String getRowIdAlias() {
|
||||||
return rowIdAlias;
|
return rowIdAlias;
|
||||||
}
|
}
|
||||||
|
|
|
@ -245,7 +245,7 @@ public class CriteriaQueryTranslator implements CriteriaQuery {
|
||||||
final Type type = provider.getType( componentPath );
|
final Type type = provider.getType( componentPath );
|
||||||
if ( type.isAssociationType() ) {
|
if ( type.isAssociationType() ) {
|
||||||
// CollectionTypes are always also AssociationTypes - but there's not always an associated entity...
|
// CollectionTypes are always also AssociationTypes - but there's not always an associated entity...
|
||||||
final AssociationType atype = ( AssociationType ) type;
|
final AssociationType atype = (AssociationType) type;
|
||||||
final CollectionType ctype = type.isCollectionType() ? (CollectionType)type : null;
|
final CollectionType ctype = type.isCollectionType() ? (CollectionType)type : null;
|
||||||
final Type elementType = (ctype != null) ? ctype.getElementType( sessionFactory ) : null;
|
final Type elementType = (ctype != null) ? ctype.getElementType( sessionFactory ) : null;
|
||||||
// is the association a collection of components or value-types? (i.e a colloction of valued types?)
|
// is the association a collection of components or value-types? (i.e a colloction of valued types?)
|
||||||
|
@ -256,16 +256,19 @@ public class CriteriaQueryTranslator implements CriteriaQuery {
|
||||||
provider = new ScalarCollectionCriteriaInfoProvider( helper, ctype.getRole() );
|
provider = new ScalarCollectionCriteriaInfoProvider( helper, ctype.getRole() );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
provider = new EntityCriteriaInfoProvider(( Queryable ) sessionFactory.getEntityPersister(
|
provider = new EntityCriteriaInfoProvider(
|
||||||
atype.getAssociatedEntityName( sessionFactory )
|
(Queryable) sessionFactory.getEntityPersister( atype.getAssociatedEntityName( sessionFactory ) )
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentPath = "";
|
componentPath = "";
|
||||||
}
|
}
|
||||||
else if ( type.isComponentType() ) {
|
else if ( type.isComponentType() ) {
|
||||||
if (!tokens.hasMoreTokens()) {
|
if (!tokens.hasMoreTokens()) {
|
||||||
throw new QueryException("Criteria objects cannot be created directly on components. Create a criteria on owning entity and use a dotted property to access component property: "+path);
|
throw new QueryException(
|
||||||
|
"Criteria objects cannot be created directly on components. Create a criteria on " +
|
||||||
|
"owning entity and use a dotted property to access component property: " + path
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
componentPath += '.';
|
componentPath += '.';
|
||||||
|
@ -588,14 +591,15 @@ public class CriteriaQueryTranslator implements CriteriaQuery {
|
||||||
public TypedValue getTypedValue(Criteria subcriteria, String propertyName, Object value) throws HibernateException {
|
public TypedValue getTypedValue(Criteria subcriteria, String propertyName, Object value) throws HibernateException {
|
||||||
// Detect discriminator values...
|
// Detect discriminator values...
|
||||||
if ( value instanceof Class ) {
|
if ( value instanceof Class ) {
|
||||||
final Class entityClass = ( Class ) value;
|
final Class entityClass = (Class) value;
|
||||||
final Queryable q = SessionFactoryHelper.findQueryableUsingImports( sessionFactory, entityClass.getName() );
|
final Queryable q = SessionFactoryHelper.findQueryableUsingImports( sessionFactory, entityClass.getName() );
|
||||||
if ( q != null ) {
|
if ( q != null ) {
|
||||||
final Type type = q.getDiscriminatorType();
|
final Type type = q.getDiscriminatorType();
|
||||||
String stringValue = q.getDiscriminatorSQLValue();
|
String stringValue = q.getDiscriminatorSQLValue();
|
||||||
if (stringValue != null && stringValue.length() > 2
|
if ( stringValue != null
|
||||||
|
&& stringValue.length() > 2
|
||||||
&& stringValue.startsWith( "'" )
|
&& stringValue.startsWith( "'" )
|
||||||
&& stringValue.endsWith( "'" )) {
|
&& stringValue.endsWith( "'" ) ) {
|
||||||
// remove the single quotes
|
// remove the single quotes
|
||||||
stringValue = stringValue.substring( 1, stringValue.length() - 1 );
|
stringValue = stringValue.substring( 1, stringValue.length() - 1 );
|
||||||
}
|
}
|
||||||
|
@ -616,7 +620,7 @@ public class CriteriaQueryTranslator implements CriteriaQuery {
|
||||||
}
|
}
|
||||||
|
|
||||||
private PropertyMapping getPropertyMapping(String entityName) throws MappingException {
|
private PropertyMapping getPropertyMapping(String entityName) throws MappingException {
|
||||||
final CriteriaInfoProvider info = nameCriteriaInfoMap.get(entityName);
|
final CriteriaInfoProvider info = nameCriteriaInfoMap.get( entityName );
|
||||||
if ( info == null ) {
|
if ( info == null ) {
|
||||||
throw new HibernateException( "Unknown entity: " + entityName );
|
throw new HibernateException( "Unknown entity: " + entityName );
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,21 +198,19 @@ public class ReturnGraphTreePrinter {
|
||||||
CollectionReference collectionReference,
|
CollectionReference collectionReference,
|
||||||
int depth,
|
int depth,
|
||||||
PrintWriter printWriter) {
|
PrintWriter printWriter) {
|
||||||
{
|
final CollectionFetchableIndex indexGraph = collectionReference.getIndexGraph();
|
||||||
final CollectionFetchableIndex indexGraph = collectionReference.getIndexGraph();
|
if ( indexGraph != null ) {
|
||||||
if ( indexGraph != null ) {
|
printWriter.print( TreePrinterHelper.INSTANCE.generateNodePrefix( depth ) + "(collection index) " );
|
||||||
printWriter.print( TreePrinterHelper.INSTANCE.generateNodePrefix( depth ) + "(collection index) " );
|
|
||||||
|
|
||||||
if ( EntityReference.class.isInstance( indexGraph ) ) {
|
if ( EntityReference.class.isInstance( indexGraph ) ) {
|
||||||
final EntityReference indexGraphAsEntityReference = (EntityReference) indexGraph;
|
final EntityReference indexGraphAsEntityReference = (EntityReference) indexGraph;
|
||||||
printWriter.println( extractDetails( indexGraphAsEntityReference ) );
|
printWriter.println( extractDetails( indexGraphAsEntityReference ) );
|
||||||
writeEntityReferenceFetches( indexGraphAsEntityReference, depth+1, printWriter );
|
writeEntityReferenceFetches( indexGraphAsEntityReference, depth+1, printWriter );
|
||||||
}
|
}
|
||||||
else if ( CompositeFetch.class.isInstance( indexGraph ) ) {
|
else if ( CompositeFetch.class.isInstance( indexGraph ) ) {
|
||||||
final CompositeFetch indexGraphAsCompositeFetch = (CompositeFetch) indexGraph;
|
final CompositeFetch indexGraphAsCompositeFetch = (CompositeFetch) indexGraph;
|
||||||
printWriter.println( extractDetails( indexGraphAsCompositeFetch ) );
|
printWriter.println( extractDetails( indexGraphAsCompositeFetch ) );
|
||||||
writeCompositeFetchFetches( indexGraphAsCompositeFetch, depth+1, printWriter );
|
writeCompositeFetchFetches( indexGraphAsCompositeFetch, depth+1, printWriter );
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
import org.hibernate.property.BackrefPropertyAccessor;
|
import org.hibernate.property.BackrefPropertyAccessor;
|
||||||
import org.hibernate.property.PropertyAccessor;
|
import org.hibernate.property.PropertyAccessor;
|
||||||
|
|
||||||
|
@ -32,16 +33,12 @@ public class Backref extends Property {
|
||||||
private String collectionRole;
|
private String collectionRole;
|
||||||
private String entityName;
|
private String entityName;
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isBackRef() {
|
public boolean isBackRef() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isSynthetic() {
|
public boolean isSynthetic() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -54,10 +51,12 @@ public class Backref extends Property {
|
||||||
this.collectionRole = collectionRole;
|
this.collectionRole = collectionRole;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isBasicPropertyAccessor() {
|
public boolean isBasicPropertyAccessor() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PropertyAccessor getPropertyAccessor(Class clazz) {
|
public PropertyAccessor getPropertyAccessor(Class clazz) {
|
||||||
return new BackrefPropertyAccessor(collectionRole, entityName);
|
return new BackrefPropertyAccessor(collectionRole, entityName);
|
||||||
}
|
}
|
||||||
|
@ -65,6 +64,7 @@ public class Backref extends Property {
|
||||||
public String getEntityName() {
|
public String getEntityName() {
|
||||||
return entityName;
|
return entityName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEntityName(String entityName) {
|
public void setEntityName(String entityName) {
|
||||||
this.entityName = entityName;
|
this.entityName = entityName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ import org.hibernate.type.TypeFactory;
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
public class Component extends SimpleValue implements MetaAttributable {
|
public class Component extends SimpleValue implements MetaAttributable {
|
||||||
private ArrayList properties = new ArrayList();
|
private ArrayList<Property> properties = new ArrayList<Property>();
|
||||||
private String componentClassName;
|
private String componentClassName;
|
||||||
private boolean embedded;
|
private boolean embedded;
|
||||||
private String parentProperty;
|
private String parentProperty;
|
||||||
|
@ -63,7 +63,7 @@ public class Component extends SimpleValue implements MetaAttributable {
|
||||||
private boolean isKey;
|
private boolean isKey;
|
||||||
private String roleName;
|
private String roleName;
|
||||||
|
|
||||||
private java.util.Map tuplizerImpls;
|
private java.util.Map<EntityMode,String> tuplizerImpls;
|
||||||
|
|
||||||
public Component(Mappings mappings, PersistentClass owner) throws MappingException {
|
public Component(Mappings mappings, PersistentClass owner) throws MappingException {
|
||||||
super( mappings, owner.getTable() );
|
super( mappings, owner.getTable() );
|
||||||
|
@ -88,15 +88,21 @@ public class Component extends SimpleValue implements MetaAttributable {
|
||||||
public int getPropertySpan() {
|
public int getPropertySpan() {
|
||||||
return properties.size();
|
return properties.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterator getPropertyIterator() {
|
public Iterator getPropertyIterator() {
|
||||||
return properties.iterator();
|
return properties.iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addProperty(Property p) {
|
public void addProperty(Property p) {
|
||||||
properties.add(p);
|
properties.add( p );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void addColumn(Column column) {
|
public void addColumn(Column column) {
|
||||||
throw new UnsupportedOperationException("Cant add a column to a component");
|
throw new UnsupportedOperationException("Cant add a column to a component");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getColumnSpan() {
|
public int getColumnSpan() {
|
||||||
int n=0;
|
int n=0;
|
||||||
Iterator iter = getPropertyIterator();
|
Iterator iter = getPropertyIterator();
|
||||||
|
@ -106,6 +112,9 @@ public class Component extends SimpleValue implements MetaAttributable {
|
||||||
}
|
}
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public Iterator<Selectable> getColumnIterator() {
|
public Iterator<Selectable> getColumnIterator() {
|
||||||
Iterator[] iters = new Iterator[ getPropertySpan() ];
|
Iterator[] iters = new Iterator[ getPropertySpan() ];
|
||||||
Iterator iter = getPropertyIterator();
|
Iterator iter = getPropertyIterator();
|
||||||
|
@ -113,11 +122,9 @@ public class Component extends SimpleValue implements MetaAttributable {
|
||||||
while ( iter.hasNext() ) {
|
while ( iter.hasNext() ) {
|
||||||
iters[i++] = ( (Property) iter.next() ).getColumnIterator();
|
iters[i++] = ( (Property) iter.next() ).getColumnIterator();
|
||||||
}
|
}
|
||||||
return new JoinedIterator(iters);
|
return new JoinedIterator( iters );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTypeByReflection(String propertyClass, String propertyName) {}
|
|
||||||
|
|
||||||
public boolean isEmbedded() {
|
public boolean isEmbedded() {
|
||||||
return embedded;
|
return embedded;
|
||||||
}
|
}
|
||||||
|
@ -167,6 +174,7 @@ public class Component extends SimpleValue implements MetaAttributable {
|
||||||
this.dynamic = dynamic;
|
this.dynamic = dynamic;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Type getType() throws MappingException {
|
public Type getType() throws MappingException {
|
||||||
// TODO : temporary initial step towards HHH-1907
|
// TODO : temporary initial step towards HHH-1907
|
||||||
final ComponentMetamodel metamodel = new ComponentMetamodel( this );
|
final ComponentMetamodel metamodel = new ComponentMetamodel( this );
|
||||||
|
@ -174,25 +182,32 @@ public class Component extends SimpleValue implements MetaAttributable {
|
||||||
return isEmbedded() ? factory.embeddedComponent( metamodel ) : factory.component( metamodel );
|
return isEmbedded() ? factory.embeddedComponent( metamodel ) : factory.component( metamodel );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setTypeUsingReflection(String className, String propertyName)
|
public void setTypeUsingReflection(String className, String propertyName)
|
||||||
throws MappingException {
|
throws MappingException {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public java.util.Map getMetaAttributes() {
|
public java.util.Map getMetaAttributes() {
|
||||||
return metaAttributes;
|
return metaAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public MetaAttribute getMetaAttribute(String attributeName) {
|
public MetaAttribute getMetaAttribute(String attributeName) {
|
||||||
return metaAttributes==null?null:(MetaAttribute) metaAttributes.get(attributeName);
|
return metaAttributes==null?null:(MetaAttribute) metaAttributes.get(attributeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setMetaAttributes(java.util.Map metas) {
|
public void setMetaAttributes(java.util.Map metas) {
|
||||||
this.metaAttributes = metas;
|
this.metaAttributes = metas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object accept(ValueVisitor visitor) {
|
public Object accept(ValueVisitor visitor) {
|
||||||
return visitor.accept(this);
|
return visitor.accept(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean[] getColumnInsertability() {
|
public boolean[] getColumnInsertability() {
|
||||||
boolean[] result = new boolean[ getColumnSpan() ];
|
boolean[] result = new boolean[ getColumnSpan() ];
|
||||||
Iterator iter = getPropertyIterator();
|
Iterator iter = getPropertyIterator();
|
||||||
|
@ -208,6 +223,7 @@ public class Component extends SimpleValue implements MetaAttributable {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean[] getColumnUpdateability() {
|
public boolean[] getColumnUpdateability() {
|
||||||
boolean[] result = new boolean[ getColumnSpan() ];
|
boolean[] result = new boolean[ getColumnSpan() ];
|
||||||
Iterator iter = getPropertyIterator();
|
Iterator iter = getPropertyIterator();
|
||||||
|
@ -245,7 +261,7 @@ public class Component extends SimpleValue implements MetaAttributable {
|
||||||
|
|
||||||
public void addTuplizer(EntityMode entityMode, String implClassName) {
|
public void addTuplizer(EntityMode entityMode, String implClassName) {
|
||||||
if ( tuplizerImpls == null ) {
|
if ( tuplizerImpls == null ) {
|
||||||
tuplizerImpls = new HashMap();
|
tuplizerImpls = new HashMap<EntityMode,String>();
|
||||||
}
|
}
|
||||||
tuplizerImpls.put( entityMode, implClassName );
|
tuplizerImpls.put( entityMode, implClassName );
|
||||||
}
|
}
|
||||||
|
@ -255,9 +271,10 @@ public class Component extends SimpleValue implements MetaAttributable {
|
||||||
if ( tuplizerImpls == null ) {
|
if ( tuplizerImpls == null ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return ( String ) tuplizerImpls.get( mode );
|
return tuplizerImpls.get( mode );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("UnusedDeclaration")
|
||||||
public Map getTuplizerMap() {
|
public Map getTuplizerMap() {
|
||||||
if ( tuplizerImpls == null ) {
|
if ( tuplizerImpls == null ) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -284,12 +301,14 @@ public class Component extends SimpleValue implements MetaAttributable {
|
||||||
this.roleName = roleName;
|
this.roleName = roleName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getClass().getName() + '(' + properties.toString() + ')';
|
return getClass().getName() + '(' + properties.toString() + ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
private IdentifierGenerator builtIdentifierGenerator;
|
private IdentifierGenerator builtIdentifierGenerator;
|
||||||
|
|
||||||
|
@Override
|
||||||
public IdentifierGenerator createIdentifierGenerator(
|
public IdentifierGenerator createIdentifierGenerator(
|
||||||
IdentifierGeneratorFactory identifierGeneratorFactory,
|
IdentifierGeneratorFactory identifierGeneratorFactory,
|
||||||
Dialect dialect,
|
Dialect dialect,
|
||||||
|
@ -396,6 +415,7 @@ public class Component extends SimpleValue implements MetaAttributable {
|
||||||
this.entityName = entityName;
|
this.entityName = entityName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Serializable locateGenerationContext(SessionImplementor session, Object incomingObject) {
|
public Serializable locateGenerationContext(SessionImplementor session, Object incomingObject) {
|
||||||
return session.getEntityPersister( entityName, incomingObject ).getIdentifier( incomingObject, session );
|
return session.getEntityPersister( entityName, incomingObject ).getIdentifier( incomingObject, session );
|
||||||
}
|
}
|
||||||
|
@ -415,14 +435,13 @@ public class Component extends SimpleValue implements MetaAttributable {
|
||||||
this.injector = injector;
|
this.injector = injector;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void execute(SessionImplementor session, Object incomingObject, Object injectionContext) {
|
public void execute(SessionImplementor session, Object incomingObject, Object injectionContext) {
|
||||||
final Object generatedValue = subGenerator.generate( session, incomingObject );
|
final Object generatedValue = subGenerator.generate( session, incomingObject );
|
||||||
injector.set( injectionContext, generatedValue, session.getFactory() );
|
injector.set( injectionContext, generatedValue, session.getFactory() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void registerPersistentGenerators(Map generatorMap) {
|
public void registerPersistentGenerators(Map generatorMap) {
|
||||||
if ( PersistentIdentifierGenerator.class.isInstance( subGenerator ) ) {
|
if ( PersistentIdentifierGenerator.class.isInstance( subGenerator ) ) {
|
||||||
generatorMap.put( ( (PersistentIdentifierGenerator) subGenerator ).generatorKey(), subGenerator );
|
generatorMap.put( ( (PersistentIdentifierGenerator) subGenerator ).generatorKey(), subGenerator );
|
||||||
|
|
|
@ -88,9 +88,7 @@ public class FetchProfile {
|
||||||
fetches.add( new Fetch( entity, association, style ) );
|
fetches.add( new Fetch( entity, association, style ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if ( this == o ) {
|
if ( this == o ) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -104,9 +102,7 @@ public class FetchProfile {
|
||||||
return name.equals( that.name );
|
return name.equals( that.name );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return name.hashCode();
|
return name.hashCode();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import org.hibernate.dialect.Dialect;
|
import org.hibernate.dialect.Dialect;
|
||||||
|
@ -33,7 +34,7 @@ import org.hibernate.sql.Template;
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
public class Formula implements Selectable, Serializable {
|
public class Formula implements Selectable, Serializable {
|
||||||
private static int formulaUniqueInteger=0;
|
private static int formulaUniqueInteger;
|
||||||
|
|
||||||
private String formula;
|
private String formula;
|
||||||
private int uniqueInteger;
|
private int uniqueInteger;
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
package org.hibernate.mapping;
|
package org.hibernate.mapping;
|
||||||
|
|
||||||
import org.hibernate.property.IndexPropertyAccessor;
|
import org.hibernate.property.IndexPropertyAccessor;
|
||||||
import org.hibernate.property.PropertyAccessor;
|
import org.hibernate.property.PropertyAccessor;
|
||||||
|
|
||||||
|
@ -31,14 +32,13 @@ import org.hibernate.property.PropertyAccessor;
|
||||||
public class IndexBackref extends Property {
|
public class IndexBackref extends Property {
|
||||||
private String collectionRole;
|
private String collectionRole;
|
||||||
private String entityName;
|
private String entityName;
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isBackRef() {
|
public boolean isBackRef() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isSynthetic() {
|
public boolean isSynthetic() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -51,10 +51,12 @@ public class IndexBackref extends Property {
|
||||||
this.collectionRole = collectionRole;
|
this.collectionRole = collectionRole;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isBasicPropertyAccessor() {
|
public boolean isBasicPropertyAccessor() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public PropertyAccessor getPropertyAccessor(Class clazz) {
|
public PropertyAccessor getPropertyAccessor(Class clazz) {
|
||||||
return new IndexPropertyAccessor(collectionRole, entityName);
|
return new IndexPropertyAccessor(collectionRole, entityName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -248,7 +248,7 @@ public class Table implements RelationalModel, Serializable {
|
||||||
return uniqueKeys;
|
return uniqueKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int sizeOfUniqueKeyMapOnLastCleanse = 0;
|
private int sizeOfUniqueKeyMapOnLastCleanse;
|
||||||
|
|
||||||
private void cleanseUniqueKeyMapIfNeeded() {
|
private void cleanseUniqueKeyMapIfNeeded() {
|
||||||
if ( uniqueKeys.size() == sizeOfUniqueKeyMapOnLastCleanse ) {
|
if ( uniqueKeys.size() == sizeOfUniqueKeyMapOnLastCleanse ) {
|
||||||
|
|
|
@ -38,16 +38,11 @@ public class DerivedValue extends AbstractSimpleValue {
|
||||||
this.expression = expression;
|
this.expression = expression;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String toLoggableString() {
|
public String toLoggableString() {
|
||||||
return getTable().toLoggableString() + ".{derived-column}";
|
return getTable().toLoggableString() + ".{derived-column}";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public String getAlias(Dialect dialect) {
|
public String getAlias(Dialect dialect) {
|
||||||
return "formula" + Integer.toString( getPosition() ) + '_';
|
return "formula" + Integer.toString( getPosition() ) + '_';
|
||||||
|
|
|
@ -60,6 +60,7 @@ public class NamedParameterSpecification extends AbstractExplicitParameterSpecif
|
||||||
*
|
*
|
||||||
* @return The number of sql bind positions "eaten" by this bind operation.
|
* @return The number of sql bind positions "eaten" by this bind operation.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int bind(PreparedStatement statement, QueryParameters qp, SessionImplementor session, int position)
|
public int bind(PreparedStatement statement, QueryParameters qp, SessionImplementor session, int position)
|
||||||
throws SQLException {
|
throws SQLException {
|
||||||
TypedValue typedValue = qp.getNamedParameters().get( name );
|
TypedValue typedValue = qp.getNamedParameters().get( name );
|
||||||
|
@ -67,9 +68,7 @@ public class NamedParameterSpecification extends AbstractExplicitParameterSpecif
|
||||||
return typedValue.getType().getColumnSpan( session.getFactory() );
|
return typedValue.getType().getColumnSpan( session.getFactory() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String renderDisplayInfo() {
|
public String renderDisplayInfo() {
|
||||||
return "name=" + name + ", expectedType=" + getExpectedType();
|
return "name=" + name + ", expectedType=" + getExpectedType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,6 +60,7 @@ public class PositionalParameterSpecification extends AbstractExplicitParameterS
|
||||||
*
|
*
|
||||||
* @return The number of sql bind positions "eaten" by this bind operation.
|
* @return The number of sql bind positions "eaten" by this bind operation.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int bind(PreparedStatement statement, QueryParameters qp, SessionImplementor session, int position) throws SQLException {
|
public int bind(PreparedStatement statement, QueryParameters qp, SessionImplementor session, int position) throws SQLException {
|
||||||
Type type = qp.getPositionalParameterTypes()[hqlPosition];
|
Type type = qp.getPositionalParameterTypes()[hqlPosition];
|
||||||
Object value = qp.getPositionalParameterValues()[hqlPosition];
|
Object value = qp.getPositionalParameterValues()[hqlPosition];
|
||||||
|
@ -68,9 +69,7 @@ public class PositionalParameterSpecification extends AbstractExplicitParameterS
|
||||||
return type.getColumnSpan( session.getFactory() );
|
return type.getColumnSpan( session.getFactory() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String renderDisplayInfo() {
|
public String renderDisplayInfo() {
|
||||||
return "ordinal=" + hqlPosition + ", expectedType=" + getExpectedType();
|
return "ordinal=" + hqlPosition + ", expectedType=" + getExpectedType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -671,6 +671,7 @@ public abstract class AbstractCollectionPersister
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void postInstantiate() throws MappingException {
|
public void postInstantiate() throws MappingException {
|
||||||
initializer = queryLoaderName == null ?
|
initializer = queryLoaderName == null ?
|
||||||
createCollectionInitializer( LoadQueryInfluencers.NONE ) :
|
createCollectionInitializer( LoadQueryInfluencers.NONE ) :
|
||||||
|
@ -687,6 +688,7 @@ public abstract class AbstractCollectionPersister
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void initialize(Serializable key, SessionImplementor session) throws HibernateException {
|
public void initialize(Serializable key, SessionImplementor session) throws HibernateException {
|
||||||
getAppropriateInitializer( key, session ).initialize( key, session );
|
getAppropriateInitializer( key, session ).initialize( key, session );
|
||||||
}
|
}
|
||||||
|
@ -744,14 +746,17 @@ public abstract class AbstractCollectionPersister
|
||||||
protected abstract CollectionInitializer createCollectionInitializer(LoadQueryInfluencers loadQueryInfluencers)
|
protected abstract CollectionInitializer createCollectionInitializer(LoadQueryInfluencers loadQueryInfluencers)
|
||||||
throws MappingException;
|
throws MappingException;
|
||||||
|
|
||||||
|
@Override
|
||||||
public CollectionRegionAccessStrategy getCacheAccessStrategy() {
|
public CollectionRegionAccessStrategy getCacheAccessStrategy() {
|
||||||
return cacheAccessStrategy;
|
return cacheAccessStrategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasCache() {
|
public boolean hasCache() {
|
||||||
return cacheAccessStrategy != null;
|
return cacheAccessStrategy != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CollectionType getCollectionType() {
|
public CollectionType getCollectionType() {
|
||||||
return collectionType;
|
return collectionType;
|
||||||
}
|
}
|
||||||
|
@ -760,30 +765,36 @@ public abstract class AbstractCollectionPersister
|
||||||
return StringHelper.replace( sqlWhereStringTemplate, Template.TEMPLATE, alias );
|
return StringHelper.replace( sqlWhereStringTemplate, Template.TEMPLATE, alias );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getSQLOrderByString(String alias) {
|
public String getSQLOrderByString(String alias) {
|
||||||
return hasOrdering()
|
return hasOrdering()
|
||||||
? orderByTranslation.injectAliases( new StandardOrderByAliasResolver( alias ) )
|
? orderByTranslation.injectAliases( new StandardOrderByAliasResolver( alias ) )
|
||||||
: "";
|
: "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getManyToManyOrderByString(String alias) {
|
public String getManyToManyOrderByString(String alias) {
|
||||||
return hasManyToManyOrdering()
|
return hasManyToManyOrdering()
|
||||||
? manyToManyOrderByTranslation.injectAliases( new StandardOrderByAliasResolver( alias ) )
|
? manyToManyOrderByTranslation.injectAliases( new StandardOrderByAliasResolver( alias ) )
|
||||||
: "";
|
: "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public FetchMode getFetchMode() {
|
public FetchMode getFetchMode() {
|
||||||
return fetchMode;
|
return fetchMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasOrdering() {
|
public boolean hasOrdering() {
|
||||||
return hasOrder;
|
return hasOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasManyToManyOrdering() {
|
public boolean hasManyToManyOrdering() {
|
||||||
return isManyToMany() && hasManyToManyOrder;
|
return isManyToMany() && hasManyToManyOrder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasWhere() {
|
public boolean hasWhere() {
|
||||||
return hasWhere;
|
return hasWhere;
|
||||||
}
|
}
|
||||||
|
@ -804,30 +815,36 @@ public abstract class AbstractCollectionPersister
|
||||||
return sqlDeleteRowString;
|
return sqlDeleteRowString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Type getKeyType() {
|
public Type getKeyType() {
|
||||||
return keyType;
|
return keyType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Type getIndexType() {
|
public Type getIndexType() {
|
||||||
return indexType;
|
return indexType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Type getElementType() {
|
public Type getElementType() {
|
||||||
return elementType;
|
return elementType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the element class of an array, or null otherwise
|
* Return the element class of an array, or null otherwise. needed by arrays
|
||||||
*/
|
*/
|
||||||
public Class getElementClass() { // needed by arrays
|
@Override
|
||||||
|
public Class getElementClass() {
|
||||||
return elementClass;
|
return elementClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object readElement(ResultSet rs, Object owner, String[] aliases, SessionImplementor session)
|
public Object readElement(ResultSet rs, Object owner, String[] aliases, SessionImplementor session)
|
||||||
throws HibernateException, SQLException {
|
throws HibernateException, SQLException {
|
||||||
return getElementType().nullSafeGet( rs, aliases, session, owner );
|
return getElementType().nullSafeGet( rs, aliases, session, owner );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object readIndex(ResultSet rs, String[] aliases, SessionImplementor session)
|
public Object readIndex(ResultSet rs, String[] aliases, SessionImplementor session)
|
||||||
throws HibernateException, SQLException {
|
throws HibernateException, SQLException {
|
||||||
Object index = getIndexType().nullSafeGet( rs, aliases, session, null );
|
Object index = getIndexType().nullSafeGet( rs, aliases, session, null );
|
||||||
|
@ -845,6 +862,7 @@ public abstract class AbstractCollectionPersister
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object readIdentifier(ResultSet rs, String alias, SessionImplementor session)
|
public Object readIdentifier(ResultSet rs, String alias, SessionImplementor session)
|
||||||
throws HibernateException, SQLException {
|
throws HibernateException, SQLException {
|
||||||
Object id = getIdentifierType().nullSafeGet( rs, alias, session, null );
|
Object id = getIdentifierType().nullSafeGet( rs, alias, session, null );
|
||||||
|
@ -854,6 +872,7 @@ public abstract class AbstractCollectionPersister
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object readKey(ResultSet rs, String[] aliases, SessionImplementor session)
|
public Object readKey(ResultSet rs, String[] aliases, SessionImplementor session)
|
||||||
throws HibernateException, SQLException {
|
throws HibernateException, SQLException {
|
||||||
return getKeyType().nullSafeGet( rs, aliases, session, null );
|
return getKeyType().nullSafeGet( rs, aliases, session, null );
|
||||||
|
@ -933,22 +952,27 @@ public abstract class AbstractCollectionPersister
|
||||||
return i + 1;
|
return i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isPrimitiveArray() {
|
public boolean isPrimitiveArray() {
|
||||||
return isPrimitiveArray;
|
return isPrimitiveArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isArray() {
|
public boolean isArray() {
|
||||||
return isArray;
|
return isArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getKeyColumnAliases(String suffix) {
|
public String[] getKeyColumnAliases(String suffix) {
|
||||||
return new Alias( suffix ).toAliasStrings( keyColumnAliases );
|
return new Alias( suffix ).toAliasStrings( keyColumnAliases );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getElementColumnAliases(String suffix) {
|
public String[] getElementColumnAliases(String suffix) {
|
||||||
return new Alias( suffix ).toAliasStrings( elementColumnAliases );
|
return new Alias( suffix ).toAliasStrings( elementColumnAliases );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getIndexColumnAliases(String suffix) {
|
public String[] getIndexColumnAliases(String suffix) {
|
||||||
if ( hasIndex ) {
|
if ( hasIndex ) {
|
||||||
return new Alias( suffix ).toAliasStrings( indexColumnAliases );
|
return new Alias( suffix ).toAliasStrings( indexColumnAliases );
|
||||||
|
@ -958,6 +982,7 @@ public abstract class AbstractCollectionPersister
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getIdentifierColumnAlias(String suffix) {
|
public String getIdentifierColumnAlias(String suffix) {
|
||||||
if ( hasIdentifier ) {
|
if ( hasIdentifier ) {
|
||||||
return new Alias( suffix ).toAliasString( identifierColumnAlias );
|
return new Alias( suffix ).toAliasString( identifierColumnAlias );
|
||||||
|
@ -967,6 +992,7 @@ public abstract class AbstractCollectionPersister
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getIdentifierColumnName() {
|
public String getIdentifierColumnName() {
|
||||||
if ( hasIdentifier ) {
|
if ( hasIdentifier ) {
|
||||||
return identifierColumnName;
|
return identifierColumnName;
|
||||||
|
@ -979,6 +1005,7 @@ public abstract class AbstractCollectionPersister
|
||||||
/**
|
/**
|
||||||
* Generate a list of collection index, key and element columns
|
* Generate a list of collection index, key and element columns
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String selectFragment(String alias, String columnSuffix) {
|
public String selectFragment(String alias, String columnSuffix) {
|
||||||
SelectFragment frag = generateSelectFragment( alias, columnSuffix );
|
SelectFragment frag = generateSelectFragment( alias, columnSuffix );
|
||||||
appendElementColumns( frag, alias );
|
appendElementColumns( frag, alias );
|
||||||
|
@ -1073,19 +1100,22 @@ public abstract class AbstractCollectionPersister
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getIndexColumnNames() {
|
public String[] getIndexColumnNames() {
|
||||||
return indexColumnNames;
|
return indexColumnNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getIndexFormulas() {
|
public String[] getIndexFormulas() {
|
||||||
return indexFormulas;
|
return indexFormulas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getIndexColumnNames(String alias) {
|
public String[] getIndexColumnNames(String alias) {
|
||||||
return qualify( alias, indexColumnNames, indexFormulaTemplates );
|
return qualify( alias, indexColumnNames, indexFormulaTemplates );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getElementColumnNames(String alias) {
|
public String[] getElementColumnNames(String alias) {
|
||||||
return qualify( alias, elementColumnNames, elementFormulaTemplates );
|
return qualify( alias, elementColumnNames, elementFormulaTemplates );
|
||||||
}
|
}
|
||||||
|
@ -1104,32 +1134,39 @@ public abstract class AbstractCollectionPersister
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getElementColumnNames() {
|
public String[] getElementColumnNames() {
|
||||||
return elementColumnNames; // TODO: something with formulas...
|
return elementColumnNames; // TODO: something with formulas...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String[] getKeyColumnNames() {
|
public String[] getKeyColumnNames() {
|
||||||
return keyColumnNames;
|
return keyColumnNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasIndex() {
|
public boolean hasIndex() {
|
||||||
return hasIndex;
|
return hasIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isLazy() {
|
public boolean isLazy() {
|
||||||
return isLazy;
|
return isLazy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isInverse() {
|
public boolean isInverse() {
|
||||||
return isInverse;
|
return isInverse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getTableName() {
|
public String getTableName() {
|
||||||
return qualifiedTableName;
|
return qualifiedTableName;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BasicBatchKey removeBatchKey;
|
private BasicBatchKey removeBatchKey;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void remove(Serializable id, SessionImplementor session) throws HibernateException {
|
public void remove(Serializable id, SessionImplementor session) throws HibernateException {
|
||||||
if ( !isInverse && isRowDeleteEnabled() ) {
|
if ( !isInverse && isRowDeleteEnabled() ) {
|
||||||
|
|
||||||
|
@ -1209,6 +1246,7 @@ public abstract class AbstractCollectionPersister
|
||||||
|
|
||||||
protected BasicBatchKey recreateBatchKey;
|
protected BasicBatchKey recreateBatchKey;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void recreate(PersistentCollection collection, Serializable id, SessionImplementor session)
|
public void recreate(PersistentCollection collection, Serializable id, SessionImplementor session)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
|
|
||||||
|
@ -1322,6 +1360,7 @@ public abstract class AbstractCollectionPersister
|
||||||
|
|
||||||
private BasicBatchKey deleteBatchKey;
|
private BasicBatchKey deleteBatchKey;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void deleteRows(PersistentCollection collection, Serializable id, SessionImplementor session)
|
public void deleteRows(PersistentCollection collection, Serializable id, SessionImplementor session)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
|
|
||||||
|
@ -1430,6 +1469,7 @@ public abstract class AbstractCollectionPersister
|
||||||
|
|
||||||
private BasicBatchKey insertBatchKey;
|
private BasicBatchKey insertBatchKey;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void insertRows(PersistentCollection collection, Serializable id, SessionImplementor session)
|
public void insertRows(PersistentCollection collection, Serializable id, SessionImplementor session)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
|
|
||||||
|
@ -1524,6 +1564,7 @@ public abstract class AbstractCollectionPersister
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getRole() {
|
public String getRole() {
|
||||||
return role;
|
return role;
|
||||||
}
|
}
|
||||||
|
@ -1532,22 +1573,27 @@ public abstract class AbstractCollectionPersister
|
||||||
return entityName;
|
return entityName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityPersister getOwnerEntityPersister() {
|
public EntityPersister getOwnerEntityPersister() {
|
||||||
return ownerPersister;
|
return ownerPersister;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public IdentifierGenerator getIdentifierGenerator() {
|
public IdentifierGenerator getIdentifierGenerator() {
|
||||||
return identifierGenerator;
|
return identifierGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Type getIdentifierType() {
|
public Type getIdentifierType() {
|
||||||
return identifierType;
|
return identifierType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasOrphanDelete() {
|
public boolean hasOrphanDelete() {
|
||||||
return hasOrphanDelete;
|
return hasOrphanDelete;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Type toType(String propertyName) throws QueryException {
|
public Type toType(String propertyName) throws QueryException {
|
||||||
if ( "index".equals( propertyName ) ) {
|
if ( "index".equals( propertyName ) ) {
|
||||||
return indexType;
|
return indexType;
|
||||||
|
@ -1555,8 +1601,10 @@ public abstract class AbstractCollectionPersister
|
||||||
return elementPropertyMapping.toType( propertyName );
|
return elementPropertyMapping.toType( propertyName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public abstract boolean isManyToMany();
|
public abstract boolean isManyToMany();
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getManyToManyFilterFragment(String alias, Map enabledFilters) {
|
public String getManyToManyFilterFragment(String alias, Map enabledFilters) {
|
||||||
StringBuilder buffer = new StringBuilder();
|
StringBuilder buffer = new StringBuilder();
|
||||||
manyToManyFilterHelper.render( buffer, elementPersister.getFilterAliasGenerator(alias), enabledFilters );
|
manyToManyFilterHelper.render( buffer, elementPersister.getFilterAliasGenerator(alias), enabledFilters );
|
||||||
|
@ -1569,9 +1617,7 @@ public abstract class AbstractCollectionPersister
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String[] toColumns(String alias, String propertyName) throws QueryException {
|
public String[] toColumns(String alias, String propertyName) throws QueryException {
|
||||||
if ( "index".equals( propertyName ) ) {
|
if ( "index".equals( propertyName ) ) {
|
||||||
return qualify( alias, indexColumnNames, indexFormulaTemplates );
|
return qualify( alias, indexColumnNames, indexFormulaTemplates );
|
||||||
|
@ -1581,9 +1627,7 @@ public abstract class AbstractCollectionPersister
|
||||||
|
|
||||||
private String[] indexFragments;
|
private String[] indexFragments;
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String[] toColumns(String propertyName) throws QueryException {
|
public String[] toColumns(String propertyName) throws QueryException {
|
||||||
if ( "index".equals( propertyName ) ) {
|
if ( "index".equals( propertyName ) ) {
|
||||||
if ( indexFragments == null ) {
|
if ( indexFragments == null ) {
|
||||||
|
@ -1601,14 +1645,17 @@ public abstract class AbstractCollectionPersister
|
||||||
return elementPropertyMapping.toColumns( propertyName );
|
return elementPropertyMapping.toColumns( propertyName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Type getType() {
|
public Type getType() {
|
||||||
return elementPropertyMapping.getType(); // ==elementType ??
|
return elementPropertyMapping.getType(); // ==elementType ??
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return getRole();
|
return getRole();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public EntityPersister getElementPersister() {
|
public EntityPersister getElementPersister() {
|
||||||
if ( elementPersister == null ) {
|
if ( elementPersister == null ) {
|
||||||
throw new AssertionFailure( "not an association" );
|
throw new AssertionFailure( "not an association" );
|
||||||
|
@ -1616,10 +1663,12 @@ public abstract class AbstractCollectionPersister
|
||||||
return elementPersister;
|
return elementPersister;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isCollection() {
|
public boolean isCollection() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Serializable[] getCollectionSpaces() {
|
public Serializable[] getCollectionSpaces() {
|
||||||
return spaces;
|
return spaces;
|
||||||
}
|
}
|
||||||
|
@ -1632,6 +1681,7 @@ public abstract class AbstractCollectionPersister
|
||||||
|
|
||||||
protected abstract String generateInsertRowString();
|
protected abstract String generateInsertRowString();
|
||||||
|
|
||||||
|
@Override
|
||||||
public void updateRows(PersistentCollection collection, Serializable id, SessionImplementor session)
|
public void updateRows(PersistentCollection collection, Serializable id, SessionImplementor session)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
|
|
||||||
|
@ -1649,6 +1699,7 @@ public abstract class AbstractCollectionPersister
|
||||||
protected abstract int doUpdateRows(Serializable key, PersistentCollection collection, SessionImplementor session)
|
protected abstract int doUpdateRows(Serializable key, PersistentCollection collection, SessionImplementor session)
|
||||||
throws HibernateException;
|
throws HibernateException;
|
||||||
|
|
||||||
|
@Override
|
||||||
public void processQueuedOps(PersistentCollection collection, Serializable key, SessionImplementor session)
|
public void processQueuedOps(PersistentCollection collection, Serializable key, SessionImplementor session)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
if ( collection.hasQueuedOperations() ) {
|
if ( collection.hasQueuedOperations() ) {
|
||||||
|
@ -1659,10 +1710,12 @@ public abstract class AbstractCollectionPersister
|
||||||
protected abstract void doProcessQueuedOps(PersistentCollection collection, Serializable key, SessionImplementor session)
|
protected abstract void doProcessQueuedOps(PersistentCollection collection, Serializable key, SessionImplementor session)
|
||||||
throws HibernateException;
|
throws HibernateException;
|
||||||
|
|
||||||
|
@Override
|
||||||
public CollectionMetadata getCollectionMetadata() {
|
public CollectionMetadata getCollectionMetadata() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public SessionFactoryImplementor getFactory() {
|
public SessionFactoryImplementor getFactory() {
|
||||||
return factory;
|
return factory;
|
||||||
}
|
}
|
||||||
|
@ -1675,6 +1728,7 @@ public abstract class AbstractCollectionPersister
|
||||||
return hasWhere() ? " and " + getSQLWhereString( alias ) : "";
|
return hasWhere() ? " and " + getSQLWhereString( alias ) : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String filterFragment(String alias, Map enabledFilters) throws MappingException {
|
public String filterFragment(String alias, Map enabledFilters) throws MappingException {
|
||||||
StringBuilder sessionFilterFragment = new StringBuilder();
|
StringBuilder sessionFilterFragment = new StringBuilder();
|
||||||
filterHelper.render( sessionFilterFragment, getFilterAliasGenerator(alias), enabledFilters );
|
filterHelper.render( sessionFilterFragment, getFilterAliasGenerator(alias), enabledFilters );
|
||||||
|
@ -1735,22 +1789,27 @@ public abstract class AbstractCollectionPersister
|
||||||
return deleteAllCheckStyle;
|
return deleteAllCheckStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return StringHelper.unqualify( getClass().getName() ) + '(' + role + ')';
|
return StringHelper.unqualify( getClass().getName() ) + '(' + role + ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isVersioned() {
|
public boolean isVersioned() {
|
||||||
return isVersioned && getOwnerEntityPersister().isVersioned();
|
return isVersioned && getOwnerEntityPersister().isVersioned();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getNodeName() {
|
public String getNodeName() {
|
||||||
return nodeName;
|
return nodeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getElementNodeName() {
|
public String getElementNodeName() {
|
||||||
return elementNodeName;
|
return elementNodeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getIndexNodeName() {
|
public String getIndexNodeName() {
|
||||||
return indexNodeName;
|
return indexNodeName;
|
||||||
}
|
}
|
||||||
|
@ -1765,10 +1824,12 @@ public abstract class AbstractCollectionPersister
|
||||||
return sqlExceptionHelper;
|
return sqlExceptionHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public CacheEntryStructure getCacheEntryStructure() {
|
public CacheEntryStructure getCacheEntryStructure() {
|
||||||
return cacheEntryStructure;
|
return cacheEntryStructure;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isAffectedByEnabledFilters(SessionImplementor session) {
|
public boolean isAffectedByEnabledFilters(SessionImplementor session) {
|
||||||
return filterHelper.isAffectedBy( session.getEnabledFilters() ) ||
|
return filterHelper.isAffectedBy( session.getEnabledFilters() ) ||
|
||||||
( isManyToMany() && manyToManyFilterHelper.isAffectedBy( session.getEnabledFilters() ) );
|
( isManyToMany() && manyToManyFilterHelper.isAffectedBy( session.getEnabledFilters() ) );
|
||||||
|
@ -1778,10 +1839,12 @@ public abstract class AbstractCollectionPersister
|
||||||
return subselectLoadable;
|
return subselectLoadable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isMutable() {
|
public boolean isMutable() {
|
||||||
return isMutable;
|
return isMutable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
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 );
|
||||||
|
|
||||||
|
@ -1830,6 +1893,7 @@ public abstract class AbstractCollectionPersister
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getSize(Serializable key, SessionImplementor session) {
|
public int getSize(Serializable key, SessionImplementor session) {
|
||||||
try {
|
try {
|
||||||
PreparedStatement st = session.getTransactionCoordinator()
|
PreparedStatement st = session.getTransactionCoordinator()
|
||||||
|
@ -1860,10 +1924,12 @@ public abstract class AbstractCollectionPersister
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean indexExists(Serializable key, Object index, SessionImplementor session) {
|
public boolean indexExists(Serializable key, Object index, SessionImplementor session) {
|
||||||
return exists( key, incrementIndexByBase( index ), getIndexType(), sqlDetectRowByIndexString, session );
|
return exists( key, incrementIndexByBase( index ), getIndexType(), sqlDetectRowByIndexString, session );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean elementExists(Serializable key, Object element, SessionImplementor session) {
|
public boolean elementExists(Serializable key, Object element, SessionImplementor session) {
|
||||||
return exists( key, element, getElementType(), sqlDetectRowByElementString, session );
|
return exists( key, element, getElementType(), sqlDetectRowByElementString, session );
|
||||||
}
|
}
|
||||||
|
@ -1902,6 +1968,7 @@ public abstract class AbstractCollectionPersister
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getElementByIndex(Serializable key, Object index, SessionImplementor session, Object owner) {
|
public Object getElementByIndex(Serializable key, Object index, SessionImplementor session, Object owner) {
|
||||||
try {
|
try {
|
||||||
PreparedStatement st = session.getTransactionCoordinator()
|
PreparedStatement st = session.getTransactionCoordinator()
|
||||||
|
@ -1938,6 +2005,7 @@ public abstract class AbstractCollectionPersister
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isExtraLazy() {
|
public boolean isExtraLazy() {
|
||||||
return isExtraLazy;
|
return isExtraLazy;
|
||||||
}
|
}
|
||||||
|
@ -1956,10 +2024,12 @@ public abstract class AbstractCollectionPersister
|
||||||
return initializer;
|
return initializer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getBatchSize() {
|
public int getBatchSize() {
|
||||||
return batchSize;
|
return batchSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMappedByProperty() {
|
public String getMappedByProperty() {
|
||||||
return mappedByProperty;
|
return mappedByProperty;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@ public class BackrefPropertyAccessor implements PropertyAccessor {
|
||||||
* we don't know the value of the back reference
|
* we don't know the value of the back reference
|
||||||
*/
|
*/
|
||||||
public static final Serializable UNKNOWN = new Serializable() {
|
public static final Serializable UNKNOWN = new Serializable() {
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "<unknown>";
|
return "<unknown>";
|
||||||
}
|
}
|
||||||
|
@ -78,16 +79,12 @@ public class BackrefPropertyAccessor implements PropertyAccessor {
|
||||||
this.getter = new BackrefGetter();
|
this.getter = new BackrefGetter();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Setter getSetter(Class theClass, String propertyName) {
|
public Setter getSetter(Class theClass, String propertyName) {
|
||||||
return setter;
|
return setter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Getter getGetter(Class theClass, String propertyName) {
|
public Getter getGetter(Class theClass, String propertyName) {
|
||||||
return getter;
|
return getter;
|
||||||
}
|
}
|
||||||
|
@ -97,24 +94,17 @@ public class BackrefPropertyAccessor implements PropertyAccessor {
|
||||||
* Internal implementation of a property setter specific to these back-ref properties.
|
* Internal implementation of a property setter specific to these back-ref properties.
|
||||||
*/
|
*/
|
||||||
public static final class BackrefSetter implements Setter {
|
public static final class BackrefSetter implements Setter {
|
||||||
|
@Override
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Method getMethod() {
|
public Method getMethod() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getMethodName() {
|
public String getMethodName() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void set(Object target, Object value, SessionFactoryImplementor factory) {
|
public void set(Object target, Object value, SessionFactoryImplementor factory) {
|
||||||
// this page intentionally left blank :)
|
// this page intentionally left blank :)
|
||||||
}
|
}
|
||||||
|
@ -126,10 +116,7 @@ public class BackrefPropertyAccessor implements PropertyAccessor {
|
||||||
* Internal implementation of a property getter specific to these back-ref properties.
|
* Internal implementation of a property getter specific to these back-ref properties.
|
||||||
*/
|
*/
|
||||||
public class BackrefGetter implements Getter {
|
public class BackrefGetter implements Getter {
|
||||||
|
@Override
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object getForInsert(Object target, Map mergeMap, SessionImplementor session) {
|
public Object getForInsert(Object target, Map mergeMap, SessionImplementor session) {
|
||||||
if ( session == null ) {
|
if ( session == null ) {
|
||||||
return UNKNOWN;
|
return UNKNOWN;
|
||||||
|
@ -139,37 +126,27 @@ public class BackrefPropertyAccessor implements PropertyAccessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Member getMember() {
|
public Member getMember() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object get(Object target) {
|
public Object get(Object target) {
|
||||||
return UNKNOWN;
|
return UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Method getMethod() {
|
public Method getMethod() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getMethodName() {
|
public String getMethodName() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Class getReturnType() {
|
public Class getReturnType() {
|
||||||
return Object.class;
|
return Object.class;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.hibernate.PropertyNotFoundException;
|
||||||
import org.hibernate.PropertySetterAccessException;
|
import org.hibernate.PropertySetterAccessException;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
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;
|
||||||
|
|
||||||
|
@ -47,8 +48,7 @@ import org.jboss.logging.Logger;
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
public class BasicPropertyAccessor implements PropertyAccessor {
|
public class BasicPropertyAccessor implements PropertyAccessor {
|
||||||
|
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( BasicPropertyAccessor.class );
|
||||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, BasicPropertyAccessor.class.getName());
|
|
||||||
|
|
||||||
public static final class BasicSetter implements Setter {
|
public static final class BasicSetter implements Setter {
|
||||||
private Class clazz;
|
private Class clazz;
|
||||||
|
@ -61,6 +61,7 @@ public class BasicPropertyAccessor implements PropertyAccessor {
|
||||||
this.propertyName=propertyName;
|
this.propertyName=propertyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void set(Object target, Object value, SessionFactoryImplementor factory)
|
public void set(Object target, Object value, SessionFactoryImplementor factory)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
try {
|
try {
|
||||||
|
@ -131,10 +132,12 @@ public class BasicPropertyAccessor implements PropertyAccessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Method getMethod() {
|
public Method getMethod() {
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getMethodName() {
|
public String getMethodName() {
|
||||||
return method.getName();
|
return method.getName();
|
||||||
}
|
}
|
||||||
|
@ -160,9 +163,7 @@ public class BasicPropertyAccessor implements PropertyAccessor {
|
||||||
this.propertyName=propertyName;
|
this.propertyName=propertyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object get(Object target) throws HibernateException {
|
public Object get(Object target) throws HibernateException {
|
||||||
try {
|
try {
|
||||||
return method.invoke( target, (Object[]) null );
|
return method.invoke( target, (Object[]) null );
|
||||||
|
@ -198,37 +199,27 @@ public class BasicPropertyAccessor implements PropertyAccessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object getForInsert(Object target, Map mergeMap, SessionImplementor session) {
|
public Object getForInsert(Object target, Map mergeMap, SessionImplementor session) {
|
||||||
return get( target );
|
return get( target );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Class getReturnType() {
|
public Class getReturnType() {
|
||||||
return method.getReturnType();
|
return method.getReturnType();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Member getMember() {
|
public Member getMember() {
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Method getMethod() {
|
public Method getMethod() {
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getMethodName() {
|
public String getMethodName() {
|
||||||
return method.getName();
|
return method.getName();
|
||||||
}
|
}
|
||||||
|
@ -244,13 +235,12 @@ public class BasicPropertyAccessor implements PropertyAccessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Setter getSetter(Class theClass, String propertyName)
|
@Override
|
||||||
throws PropertyNotFoundException {
|
public Setter getSetter(Class theClass, String propertyName) throws PropertyNotFoundException {
|
||||||
return createSetter(theClass, propertyName);
|
return createSetter(theClass, propertyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Setter createSetter(Class theClass, String propertyName)
|
private static Setter createSetter(Class theClass, String propertyName) throws PropertyNotFoundException {
|
||||||
throws PropertyNotFoundException {
|
|
||||||
BasicSetter result = getSetterOrNull(theClass, propertyName);
|
BasicSetter result = getSetterOrNull(theClass, propertyName);
|
||||||
if (result==null) {
|
if (result==null) {
|
||||||
throw new PropertyNotFoundException(
|
throw new PropertyNotFoundException(
|
||||||
|
@ -287,7 +277,6 @@ public class BasicPropertyAccessor implements PropertyAccessor {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Method setterMethod(Class theClass, String propertyName) {
|
private static Method setterMethod(Class theClass, String propertyName) {
|
||||||
|
|
||||||
BasicGetter getter = getGetterOrNull(theClass, propertyName);
|
BasicGetter getter = getGetterOrNull(theClass, propertyName);
|
||||||
Class returnType = (getter==null) ? null : getter.getReturnType();
|
Class returnType = (getter==null) ? null : getter.getReturnType();
|
||||||
|
|
||||||
|
@ -310,6 +299,7 @@ public class BasicPropertyAccessor implements PropertyAccessor {
|
||||||
return potentialSetter;
|
return potentialSetter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Getter getGetter(Class theClass, String propertyName) throws PropertyNotFoundException {
|
public Getter getGetter(Class theClass, String propertyName) throws PropertyNotFoundException {
|
||||||
return createGetter(theClass, propertyName);
|
return createGetter(theClass, propertyName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,7 @@ public class DirectPropertyAccessor implements PropertyAccessor {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object get(Object target) throws HibernateException {
|
public Object get(Object target) throws HibernateException {
|
||||||
try {
|
try {
|
||||||
return field.get(target);
|
return field.get(target);
|
||||||
|
@ -63,37 +61,27 @@ public class DirectPropertyAccessor implements PropertyAccessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object getForInsert(Object target, Map mergeMap, SessionImplementor session) {
|
public Object getForInsert(Object target, Map mergeMap, SessionImplementor session) {
|
||||||
return get( target );
|
return get( target );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Member getMember() {
|
public Member getMember() {
|
||||||
return field;
|
return field;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Method getMethod() {
|
public Method getMethod() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getMethodName() {
|
public String getMethodName() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Class getReturnType() {
|
public Class getReturnType() {
|
||||||
return field.getType();
|
return field.getType();
|
||||||
}
|
}
|
||||||
|
@ -101,7 +89,8 @@ public class DirectPropertyAccessor implements PropertyAccessor {
|
||||||
Object readResolve() {
|
Object readResolve() {
|
||||||
return new DirectGetter( getField(clazz, name), clazz, name );
|
return new DirectGetter( getField(clazz, name), clazz, name );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "DirectGetter(" + clazz.getName() + '.' + name + ')';
|
return "DirectGetter(" + clazz.getName() + '.' + name + ')';
|
||||||
}
|
}
|
||||||
|
@ -117,23 +106,17 @@ public class DirectPropertyAccessor implements PropertyAccessor {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Method getMethod() {
|
public Method getMethod() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getMethodName() {
|
public String getMethodName() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void set(Object target, Object value, SessionFactoryImplementor factory) throws HibernateException {
|
public void set(Object target, Object value, SessionFactoryImplementor factory) throws HibernateException {
|
||||||
try {
|
try {
|
||||||
field.set(target, value);
|
field.set(target, value);
|
||||||
|
@ -153,6 +136,7 @@ public class DirectPropertyAccessor implements PropertyAccessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "DirectSetter(" + clazz.getName() + '.' + name + ')';
|
return "DirectSetter(" + clazz.getName() + '.' + name + ')';
|
||||||
}
|
}
|
||||||
|
@ -191,14 +175,14 @@ public class DirectPropertyAccessor implements PropertyAccessor {
|
||||||
if ( !ReflectHelper.isPublic(clazz, field) ) field.setAccessible(true);
|
if ( !ReflectHelper.isPublic(clazz, field) ) field.setAccessible(true);
|
||||||
return field;
|
return field;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Getter getGetter(Class theClass, String propertyName)
|
@Override
|
||||||
throws PropertyNotFoundException {
|
public Getter getGetter(Class theClass, String propertyName) throws PropertyNotFoundException {
|
||||||
return new DirectGetter( getField(theClass, propertyName), theClass, propertyName );
|
return new DirectGetter( getField(theClass, propertyName), theClass, propertyName );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Setter getSetter(Class theClass, String propertyName)
|
@Override
|
||||||
throws PropertyNotFoundException {
|
public Setter getSetter(Class theClass, String propertyName) throws PropertyNotFoundException {
|
||||||
return new DirectSetter( getField(theClass, propertyName), theClass, propertyName );
|
return new DirectSetter( getField(theClass, propertyName), theClass, propertyName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,56 +35,45 @@ import org.hibernate.engine.spi.SessionImplementor;
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
public class EmbeddedPropertyAccessor implements PropertyAccessor {
|
public class EmbeddedPropertyAccessor implements PropertyAccessor {
|
||||||
|
|
||||||
public static final class EmbeddedGetter implements Getter {
|
public static final class EmbeddedGetter implements Getter {
|
||||||
private final Class clazz;
|
private final Class clazz;
|
||||||
|
|
||||||
EmbeddedGetter(Class clazz) {
|
EmbeddedGetter(Class clazz) {
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object get(Object target) throws HibernateException {
|
public Object get(Object target) throws HibernateException {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object getForInsert(Object target, Map mergeMap, SessionImplementor session) {
|
public Object getForInsert(Object target, Map mergeMap, SessionImplementor session) {
|
||||||
return get( target );
|
return get( target );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Member getMember() {
|
public Member getMember() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Method getMethod() {
|
public Method getMethod() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getMethodName() {
|
public String getMethodName() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Class getReturnType() {
|
public Class getReturnType() {
|
||||||
return clazz;
|
return clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "EmbeddedGetter(" + clazz.getName() + ')';
|
return "EmbeddedGetter(" + clazz.getName() + ')';
|
||||||
}
|
}
|
||||||
|
@ -96,42 +85,34 @@ public class EmbeddedPropertyAccessor implements PropertyAccessor {
|
||||||
EmbeddedSetter(Class clazz) {
|
EmbeddedSetter(Class clazz) {
|
||||||
this.clazz = clazz;
|
this.clazz = clazz;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Method getMethod() {
|
public Method getMethod() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getMethodName() {
|
public String getMethodName() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void set(Object target, Object value, SessionFactoryImplementor factory) {
|
public void set(Object target, Object value, SessionFactoryImplementor factory) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "EmbeddedSetter(" + clazz.getName() + ')';
|
return "EmbeddedSetter(" + clazz.getName() + ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Getter getGetter(Class theClass, String propertyName)
|
@Override
|
||||||
throws PropertyNotFoundException {
|
public Getter getGetter(Class theClass, String propertyName) throws PropertyNotFoundException {
|
||||||
return new EmbeddedGetter(theClass);
|
return new EmbeddedGetter(theClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Setter getSetter(Class theClass, String propertyName)
|
@Override
|
||||||
throws PropertyNotFoundException {
|
public Setter getSetter(Class theClass, String propertyName) throws PropertyNotFoundException {
|
||||||
return new EmbeddedSetter(theClass);
|
return new EmbeddedSetter(theClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,10 +50,12 @@ public class IndexPropertyAccessor implements PropertyAccessor {
|
||||||
this.entityName = entityName;
|
this.entityName = entityName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Setter getSetter(Class theClass, String propertyName) {
|
public Setter getSetter(Class theClass, String propertyName) {
|
||||||
return new IndexSetter();
|
return new IndexSetter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Getter getGetter(Class theClass, String propertyName) {
|
public Getter getGetter(Class theClass, String propertyName) {
|
||||||
return new IndexGetter();
|
return new IndexGetter();
|
||||||
}
|
}
|
||||||
|
@ -63,27 +65,20 @@ public class IndexPropertyAccessor implements PropertyAccessor {
|
||||||
* The Setter implementation for index backrefs.
|
* The Setter implementation for index backrefs.
|
||||||
*/
|
*/
|
||||||
public static final class IndexSetter implements Setter {
|
public static final class IndexSetter implements Setter {
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Method getMethod() {
|
public Method getMethod() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getMethodName() {
|
public String getMethodName() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void set(Object target, Object value, SessionFactoryImplementor factory) {
|
public void set(Object target, Object value, SessionFactoryImplementor factory) {
|
||||||
// do nothing...
|
// do nothing...
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -91,47 +86,37 @@ public class IndexPropertyAccessor implements PropertyAccessor {
|
||||||
* The Getter implementation for index backrefs.
|
* The Getter implementation for index backrefs.
|
||||||
*/
|
*/
|
||||||
public class IndexGetter implements Getter {
|
public class IndexGetter implements Getter {
|
||||||
|
@Override
|
||||||
public Object getForInsert(Object target, Map mergeMap, SessionImplementor session) throws HibernateException {
|
public Object getForInsert(Object target, Map mergeMap, SessionImplementor session) throws HibernateException {
|
||||||
if (session==null) {
|
if ( session == null ) {
|
||||||
return BackrefPropertyAccessor.UNKNOWN;
|
return BackrefPropertyAccessor.UNKNOWN;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return session.getPersistenceContext()
|
return session.getPersistenceContext().getIndexInOwner( entityName, propertyName, target, mergeMap );
|
||||||
.getIndexInOwner(entityName, propertyName, target, mergeMap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object get(Object target) {
|
public Object get(Object target) {
|
||||||
return BackrefPropertyAccessor.UNKNOWN;
|
return BackrefPropertyAccessor.UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Member getMember() {
|
public Member getMember() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Method getMethod() {
|
public Method getMethod() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getMethodName() {
|
public String getMethodName() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Class getReturnType() {
|
public Class getReturnType() {
|
||||||
return Object.class;
|
return Object.class;
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,17 +35,13 @@ import org.hibernate.engine.spi.SessionImplementor;
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
public class MapAccessor implements PropertyAccessor {
|
public class MapAccessor implements PropertyAccessor {
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Getter getGetter(Class theClass, String propertyName)
|
public Getter getGetter(Class theClass, String propertyName)
|
||||||
throws PropertyNotFoundException {
|
throws PropertyNotFoundException {
|
||||||
return new MapGetter(propertyName);
|
return new MapGetter(propertyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Setter getSetter(Class theClass, String propertyName)
|
public Setter getSetter(Class theClass, String propertyName)
|
||||||
throws PropertyNotFoundException {
|
throws PropertyNotFoundException {
|
||||||
return new MapSetter(propertyName);
|
return new MapSetter(propertyName);
|
||||||
|
@ -58,26 +54,21 @@ public class MapAccessor implements PropertyAccessor {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Method getMethod() {
|
public Method getMethod() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getMethodName() {
|
public String getMethodName() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
@SuppressWarnings("unchecked")
|
||||||
*/
|
|
||||||
public void set(Object target, Object value, SessionFactoryImplementor factory)
|
public void set(Object target, Object value, SessionFactoryImplementor factory)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
( (Map) target ).put(name, value);
|
( (Map) target ).put( name, value );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -89,44 +80,32 @@ public class MapAccessor implements PropertyAccessor {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Member getMember() {
|
public Member getMember() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Method getMethod() {
|
public Method getMethod() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getMethodName() {
|
public String getMethodName() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object get(Object target) throws HibernateException {
|
public Object get(Object target) throws HibernateException {
|
||||||
return ( (Map) target ).get(name);
|
return ( (Map) target ).get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object getForInsert(Object target, Map mergeMap, SessionImplementor session) {
|
public Object getForInsert(Object target, Map mergeMap, SessionImplementor session) {
|
||||||
return get( target );
|
return get( target );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Class getReturnType() {
|
public Class getReturnType() {
|
||||||
return Object.class;
|
return Object.class;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,16 +37,12 @@ import org.hibernate.engine.spi.SessionImplementor;
|
||||||
* @author Michael Bartmann
|
* @author Michael Bartmann
|
||||||
*/
|
*/
|
||||||
public class NoopAccessor implements PropertyAccessor {
|
public class NoopAccessor implements PropertyAccessor {
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Getter getGetter(Class arg0, String arg1) throws PropertyNotFoundException {
|
public Getter getGetter(Class arg0, String arg1) throws PropertyNotFoundException {
|
||||||
return new NoopGetter();
|
return new NoopGetter();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Setter getSetter(Class arg0, String arg1) throws PropertyNotFoundException {
|
public Setter getSetter(Class arg0, String arg1) throws PropertyNotFoundException {
|
||||||
return new NoopSetter();
|
return new NoopSetter();
|
||||||
}
|
}
|
||||||
|
@ -60,42 +56,33 @@ public class NoopAccessor implements PropertyAccessor {
|
||||||
* <p/>
|
* <p/>
|
||||||
* Here we always return <tt>null</tt>
|
* Here we always return <tt>null</tt>
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object get(Object target) throws HibernateException {
|
public Object get(Object target) throws HibernateException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object getForInsert(Object target, Map map, SessionImplementor arg1)
|
public Object getForInsert(Object target, Map map, SessionImplementor arg1)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Class getReturnType() {
|
public Class getReturnType() {
|
||||||
return Object.class;
|
return Object.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Member getMember() {
|
public Member getMember() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getMethodName() {
|
public String getMethodName() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Method getMethod() {
|
public Method getMethod() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -105,23 +92,17 @@ public class NoopAccessor implements PropertyAccessor {
|
||||||
* A Setter which will just do nothing.
|
* A Setter which will just do nothing.
|
||||||
*/
|
*/
|
||||||
private static class NoopSetter implements Setter {
|
private static class NoopSetter implements Setter {
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void set(Object target, Object value, SessionFactoryImplementor arg2) {
|
public void set(Object target, Object value, SessionFactoryImplementor arg2) {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getMethodName() {
|
public String getMethodName() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Method getMethod() {
|
public Method getMethod() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,7 @@ public class AliasToBeanConstructorResultTransformer implements ResultTransforme
|
||||||
/**
|
/**
|
||||||
* Wrap the incoming tuples in a call to our configured constructor.
|
* Wrap the incoming tuples in a call to our configured constructor.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object transformTuple(Object[] tuple, String[] aliases) {
|
public Object transformTuple(Object[] tuple, String[] aliases) {
|
||||||
try {
|
try {
|
||||||
return constructor.newInstance( tuple );
|
return constructor.newInstance( tuple );
|
||||||
|
@ -61,9 +62,7 @@ public class AliasToBeanConstructorResultTransformer implements ResultTransforme
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public List transformList(List collection) {
|
public List transformList(List collection) {
|
||||||
return collection;
|
return collection;
|
||||||
}
|
}
|
||||||
|
@ -73,6 +72,7 @@ public class AliasToBeanConstructorResultTransformer implements ResultTransforme
|
||||||
*
|
*
|
||||||
* @return Our defined ctor hashCode
|
* @return Our defined ctor hashCode
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return constructor.hashCode();
|
return constructor.hashCode();
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,7 @@ public class AliasToBeanConstructorResultTransformer implements ResultTransforme
|
||||||
* @param other The other instance to check for equality.
|
* @param other The other instance to check for equality.
|
||||||
* @return True if both have the same defined constuctor; false otherwise.
|
* @return True if both have the same defined constuctor; false otherwise.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean equals(Object other) {
|
public boolean equals(Object other) {
|
||||||
return other instanceof AliasToBeanConstructorResultTransformer
|
return other instanceof AliasToBeanConstructorResultTransformer
|
||||||
&& constructor.equals( ( ( AliasToBeanConstructorResultTransformer ) other ).constructor );
|
&& constructor.equals( ( ( AliasToBeanConstructorResultTransformer ) other ).constructor );
|
||||||
|
|
|
@ -70,13 +70,12 @@ public class AliasToBeanResultTransformer extends AliasedTupleSubsetResultTransf
|
||||||
this.resultClass = resultClass;
|
this.resultClass = resultClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isTransformedValueATupleElement(String[] aliases, int tupleLength) {
|
public boolean isTransformedValueATupleElement(String[] aliases, int tupleLength) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object transformTuple(Object[] tuple, String[] aliases) {
|
public Object transformTuple(Object[] tuple, String[] aliases) {
|
||||||
Object result;
|
Object result;
|
||||||
|
|
||||||
|
@ -133,6 +132,7 @@ public class AliasToBeanResultTransformer extends AliasedTupleSubsetResultTransf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if ( this == o ) {
|
if ( this == o ) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -153,6 +153,7 @@ public class AliasToBeanResultTransformer extends AliasedTupleSubsetResultTransf
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = resultClass.hashCode();
|
int result = resultClass.hashCode();
|
||||||
result = 31 * result + ( aliases != null ? Arrays.hashCode( aliases ) : 0 );
|
result = 31 * result + ( aliases != null ? Arrays.hashCode( aliases ) : 0 );
|
||||||
|
|
|
@ -46,9 +46,7 @@ public class AliasToEntityMapResultTransformer extends AliasedTupleSubsetResultT
|
||||||
private AliasToEntityMapResultTransformer() {
|
private AliasToEntityMapResultTransformer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object transformTuple(Object[] tuple, String[] aliases) {
|
public Object transformTuple(Object[] tuple, String[] aliases) {
|
||||||
Map result = new HashMap(tuple.length);
|
Map result = new HashMap(tuple.length);
|
||||||
for ( int i=0; i<tuple.length; i++ ) {
|
for ( int i=0; i<tuple.length; i++ ) {
|
||||||
|
@ -60,9 +58,7 @@ public class AliasToEntityMapResultTransformer extends AliasedTupleSubsetResultT
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isTransformedValueATupleElement(String[] aliases, int tupleLength) {
|
public boolean isTransformedValueATupleElement(String[] aliases, int tupleLength) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.transform;
|
package org.hibernate.transform;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of TupleSubsetResultTransformer that ignores a
|
* An implementation of TupleSubsetResultTransformer that ignores a
|
||||||
* tuple element if its corresponding alias is null.
|
* tuple element if its corresponding alias is null.
|
||||||
|
@ -35,9 +34,7 @@ public abstract class AliasedTupleSubsetResultTransformer
|
||||||
extends BasicTransformerAdapter
|
extends BasicTransformerAdapter
|
||||||
implements TupleSubsetResultTransformer {
|
implements TupleSubsetResultTransformer {
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean[] includeInTransform(String[] aliases, int tupleLength) {
|
public boolean[] includeInTransform(String[] aliases, int tupleLength) {
|
||||||
if ( aliases == null ) {
|
if ( aliases == null ) {
|
||||||
throw new IllegalArgumentException( "aliases cannot be null" );
|
throw new IllegalArgumentException( "aliases cannot be null" );
|
||||||
|
|
|
@ -52,6 +52,7 @@ public class DistinctRootEntityResultTransformer implements TupleSubsetResultTra
|
||||||
* @param aliases The tuple aliases
|
* @param aliases The tuple aliases
|
||||||
* @return The transformed tuple row.
|
* @return The transformed tuple row.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object transformTuple(Object[] tuple, String[] aliases) {
|
public Object transformTuple(Object[] tuple, String[] aliases) {
|
||||||
return RootEntityResultTransformer.INSTANCE.transformTuple( tuple, aliases );
|
return RootEntityResultTransformer.INSTANCE.transformTuple( tuple, aliases );
|
||||||
}
|
}
|
||||||
|
@ -62,20 +63,17 @@ public class DistinctRootEntityResultTransformer implements TupleSubsetResultTra
|
||||||
* @param list The list to transform.
|
* @param list The list to transform.
|
||||||
* @return The transformed List.
|
* @return The transformed List.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public List transformList(List list) {
|
public List transformList(List list) {
|
||||||
return DistinctResultTransformer.INSTANCE.transformList( list );
|
return DistinctResultTransformer.INSTANCE.transformList( list );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean[] includeInTransform(String[] aliases, int tupleLength) {
|
public boolean[] includeInTransform(String[] aliases, int tupleLength) {
|
||||||
return RootEntityResultTransformer.INSTANCE.includeInTransform( aliases, tupleLength );
|
return RootEntityResultTransformer.INSTANCE.includeInTransform( aliases, tupleLength );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isTransformedValueATupleElement(String[] aliases, int tupleLength) {
|
public boolean isTransformedValueATupleElement(String[] aliases, int tupleLength) {
|
||||||
return RootEntityResultTransformer.INSTANCE.isTransformedValueATupleElement( null, tupleLength );
|
return RootEntityResultTransformer.INSTANCE.isTransformedValueATupleElement( null, tupleLength );
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,23 +41,17 @@ public class PassThroughResultTransformer extends BasicTransformerAdapter implem
|
||||||
private PassThroughResultTransformer() {
|
private PassThroughResultTransformer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object transformTuple(Object[] tuple, String[] aliases) {
|
public Object transformTuple(Object[] tuple, String[] aliases) {
|
||||||
return tuple.length==1 ? tuple[0] : tuple;
|
return tuple.length==1 ? tuple[0] : tuple;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isTransformedValueATupleElement(String[] aliases, int tupleLength) {
|
public boolean isTransformedValueATupleElement(String[] aliases, int tupleLength) {
|
||||||
return tupleLength == 1;
|
return tupleLength == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean[] includeInTransform(String[] aliases, int tupleLength) {
|
public boolean[] includeInTransform(String[] aliases, int tupleLength) {
|
||||||
boolean[] includeInTransformedResult = new boolean[tupleLength];
|
boolean[] includeInTransformedResult = new boolean[tupleLength];
|
||||||
Arrays.fill( includeInTransformedResult, true );
|
Arrays.fill( includeInTransformedResult, true );
|
||||||
|
|
|
@ -54,18 +54,13 @@ public final class RootEntityResultTransformer extends BasicTransformerAdapter i
|
||||||
return tuple[ tuple.length-1 ];
|
return tuple[ tuple.length-1 ];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isTransformedValueATupleElement(String[] aliases, int tupleLength) {
|
public boolean isTransformedValueATupleElement(String[] aliases, int tupleLength) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean[] includeInTransform(String[] aliases, int tupleLength) {
|
public boolean[] includeInTransform(String[] aliases, int tupleLength) {
|
||||||
|
|
||||||
boolean[] includeInTransform;
|
boolean[] includeInTransform;
|
||||||
if ( tupleLength == 1 ) {
|
if ( tupleLength == 1 ) {
|
||||||
includeInTransform = ArrayHelper.TRUE;
|
includeInTransform = ArrayHelper.TRUE;
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
* Boston, MA 02110-1301 USA
|
* Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package org.hibernate.transform;
|
package org.hibernate.transform;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -31,7 +32,6 @@ import java.util.List;
|
||||||
* you end up with is a {@link List} of {@link List Lists}.
|
* you end up with is a {@link List} of {@link List Lists}.
|
||||||
*/
|
*/
|
||||||
public class ToListResultTransformer extends BasicTransformerAdapter {
|
public class ToListResultTransformer extends BasicTransformerAdapter {
|
||||||
|
|
||||||
public static final ToListResultTransformer INSTANCE = new ToListResultTransformer();
|
public static final ToListResultTransformer INSTANCE = new ToListResultTransformer();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,9 +40,7 @@ public class ToListResultTransformer extends BasicTransformerAdapter {
|
||||||
private ToListResultTransformer() {
|
private ToListResultTransformer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object transformTuple(Object[] tuple, String[] aliases) {
|
public Object transformTuple(Object[] tuple, String[] aliases) {
|
||||||
return Arrays.asList( tuple );
|
return Arrays.asList( tuple );
|
||||||
}
|
}
|
||||||
|
|
|
@ -319,10 +319,12 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
||||||
return entityMetamodel.getSubclassEntityNames();
|
return entityMetamodel.getSubclassEntityNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Serializable getIdentifier(Object entity) throws HibernateException {
|
public Serializable getIdentifier(Object entity) throws HibernateException {
|
||||||
return getIdentifier( entity, null );
|
return getIdentifier( entity, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Serializable getIdentifier(Object entity, SessionImplementor session) {
|
public Serializable getIdentifier(Object entity, SessionImplementor session) {
|
||||||
final Object id;
|
final Object id;
|
||||||
if ( entityMetamodel.getIdentifierProperty().isEmbedded() ) {
|
if ( entityMetamodel.getIdentifierProperty().isEmbedded() ) {
|
||||||
|
@ -360,19 +362,14 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void setIdentifier(Object entity, Serializable id) throws HibernateException {
|
public void setIdentifier(Object entity, Serializable id) throws HibernateException {
|
||||||
// 99% of the time the session is not needed. Its only needed for certain brain-dead
|
// 99% of the time the session is not needed. Its only needed for certain brain-dead
|
||||||
// interpretations of JPA 2 "derived identity" support
|
// interpretations of JPA 2 "derived identity" support
|
||||||
setIdentifier( entity, id, null );
|
setIdentifier( entity, id, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void setIdentifier(Object entity, Serializable id, SessionImplementor session) {
|
public void setIdentifier(Object entity, Serializable id, SessionImplementor session) {
|
||||||
if ( entityMetamodel.getIdentifierProperty().isEmbedded() ) {
|
if ( entityMetamodel.getIdentifierProperty().isEmbedded() ) {
|
||||||
if ( entity != id ) {
|
if ( entity != id ) {
|
||||||
|
@ -433,6 +430,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
||||||
this.mappedIdentifierType = mappedIdentifierType;
|
this.mappedIdentifierType = mappedIdentifierType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getIdentifier(Object entity, EntityMode entityMode, SessionImplementor session) {
|
public Object getIdentifier(Object entity, EntityMode entityMode, SessionImplementor session) {
|
||||||
Object id = mappedIdentifierType.instantiate( entityMode );
|
Object id = mappedIdentifierType.instantiate( entityMode );
|
||||||
final Object[] propertyValues = virtualIdComponent.getPropertyValues( entity, entityMode );
|
final Object[] propertyValues = virtualIdComponent.getPropertyValues( entity, entityMode );
|
||||||
|
@ -440,6 +438,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setIdentifier(Object entity, Serializable id, EntityMode entityMode, SessionImplementor session) {
|
public void setIdentifier(Object entity, Serializable id, EntityMode entityMode, SessionImplementor session) {
|
||||||
virtualIdComponent.setPropertyValues(
|
virtualIdComponent.setPropertyValues(
|
||||||
entity,
|
entity,
|
||||||
|
@ -458,6 +457,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
||||||
this.mappedIdentifierType = mappedIdentifierType;
|
this.mappedIdentifierType = mappedIdentifierType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getIdentifier(Object entity, EntityMode entityMode, SessionImplementor session) {
|
public Object getIdentifier(Object entity, EntityMode entityMode, SessionImplementor session) {
|
||||||
final Object id = mappedIdentifierType.instantiate( entityMode );
|
final Object id = mappedIdentifierType.instantiate( entityMode );
|
||||||
final Object[] propertyValues = virtualIdComponent.getPropertyValues( entity, entityMode );
|
final Object[] propertyValues = virtualIdComponent.getPropertyValues( entity, entityMode );
|
||||||
|
@ -509,6 +509,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setIdentifier(Object entity, Serializable id, EntityMode entityMode, SessionImplementor session) {
|
public void setIdentifier(Object entity, Serializable id, EntityMode entityMode, SessionImplementor session) {
|
||||||
final Object[] extractedValues = mappedIdentifierType.getPropertyValues( id, entityMode );
|
final Object[] extractedValues = mappedIdentifierType.getPropertyValues( id, entityMode );
|
||||||
final Object[] injectionValues = new Object[ extractedValues.length ];
|
final Object[] injectionValues = new Object[ extractedValues.length ];
|
||||||
|
@ -552,18 +553,14 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
||||||
.listeners();
|
.listeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void resetIdentifier(Object entity, Serializable currentId, Object currentVersion) {
|
public void resetIdentifier(Object entity, Serializable currentId, Object currentVersion) {
|
||||||
// 99% of the time the session is not needed. Its only needed for certain brain-dead
|
// 99% of the time the session is not needed. Its only needed for certain brain-dead
|
||||||
// interpretations of JPA 2 "derived identity" support
|
// interpretations of JPA 2 "derived identity" support
|
||||||
resetIdentifier( entity, currentId, currentVersion, null );
|
resetIdentifier( entity, currentId, currentVersion, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void resetIdentifier(
|
public void resetIdentifier(
|
||||||
Object entity,
|
Object entity,
|
||||||
Serializable currentId,
|
Serializable currentId,
|
||||||
|
@ -589,6 +586,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getVersion(Object entity) throws HibernateException {
|
public Object getVersion(Object entity) throws HibernateException {
|
||||||
if ( !entityMetamodel.isVersioned() ) return null;
|
if ( !entityMetamodel.isVersioned() ) return null;
|
||||||
return getters[ entityMetamodel.getVersionPropertyIndex() ].get( entity );
|
return getters[ entityMetamodel.getVersionPropertyIndex() ].get( entity );
|
||||||
|
@ -598,6 +596,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
||||||
return !hasUninitializedLazyProperties( entity );
|
return !hasUninitializedLazyProperties( entity );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object[] getPropertyValues(Object entity) throws HibernateException {
|
public Object[] getPropertyValues(Object entity) throws HibernateException {
|
||||||
boolean getAll = shouldGetAllProperties( entity );
|
boolean getAll = shouldGetAllProperties( entity );
|
||||||
final int span = entityMetamodel.getPropertySpan();
|
final int span = entityMetamodel.getPropertySpan();
|
||||||
|
@ -615,8 +614,9 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SessionImplementor session)
|
public Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SessionImplementor session)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
final int span = entityMetamodel.getPropertySpan();
|
final int span = entityMetamodel.getPropertySpan();
|
||||||
final Object[] result = new Object[span];
|
final Object[] result = new Object[span];
|
||||||
|
|
||||||
|
@ -626,10 +626,12 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getPropertyValue(Object entity, int i) throws HibernateException {
|
public Object getPropertyValue(Object entity, int i) throws HibernateException {
|
||||||
return getters[i].get( entity );
|
return getters[i].get( entity );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object getPropertyValue(Object entity, String propertyPath) throws HibernateException {
|
public Object getPropertyValue(Object entity, String propertyPath) throws HibernateException {
|
||||||
int loc = propertyPath.indexOf('.');
|
int loc = propertyPath.indexOf('.');
|
||||||
String basePropertyName = loc > 0
|
String basePropertyName = loc > 0
|
||||||
|
@ -702,6 +704,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
||||||
throw new MappingException( "component property not found: " + subPropertyName );
|
throw new MappingException( "component property not found: " + subPropertyName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setPropertyValues(Object entity, Object[] values) throws HibernateException {
|
public void setPropertyValues(Object entity, Object[] values) throws HibernateException {
|
||||||
boolean setAll = !entityMetamodel.hasLazyProperties();
|
boolean setAll = !entityMetamodel.hasLazyProperties();
|
||||||
|
|
||||||
|
@ -712,20 +715,24 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setPropertyValue(Object entity, int i, Object value) throws HibernateException {
|
public void setPropertyValue(Object entity, int i, Object value) throws HibernateException {
|
||||||
setters[i].set( entity, value, getFactory() );
|
setters[i].set( entity, value, getFactory() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setPropertyValue(Object entity, String propertyName, Object value) throws HibernateException {
|
public void setPropertyValue(Object entity, String propertyName, Object value) throws HibernateException {
|
||||||
setters[ entityMetamodel.getPropertyIndex( propertyName ) ].set( entity, value, getFactory() );
|
setters[ entityMetamodel.getPropertyIndex( propertyName ) ].set( entity, value, getFactory() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final Object instantiate(Serializable id) throws HibernateException {
|
public final Object instantiate(Serializable id) throws HibernateException {
|
||||||
// 99% of the time the session is not needed. Its only needed for certain brain-dead
|
// 99% of the time the session is not needed. Its only needed for certain brain-dead
|
||||||
// interpretations of JPA 2 "derived identity" support
|
// interpretations of JPA 2 "derived identity" support
|
||||||
return instantiate( id, null );
|
return instantiate( id, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final Object instantiate(Serializable id, SessionImplementor session) {
|
public final Object instantiate(Serializable id, SessionImplementor session) {
|
||||||
Object result = getInstantiator().instantiate( id );
|
Object result = getInstantiator().instantiate( id );
|
||||||
if ( id != null ) {
|
if ( id != null ) {
|
||||||
|
@ -734,30 +741,37 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final Object instantiate() throws HibernateException {
|
public final Object instantiate() throws HibernateException {
|
||||||
return instantiate( null, null );
|
return instantiate( null, null );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void afterInitialize(Object entity, boolean lazyPropertiesAreUnfetched, SessionImplementor session) {}
|
public void afterInitialize(Object entity, boolean lazyPropertiesAreUnfetched, SessionImplementor session) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasUninitializedLazyProperties(Object entity) {
|
public boolean hasUninitializedLazyProperties(Object entity) {
|
||||||
// the default is to simply not lazy fetch properties for now...
|
// the default is to simply not lazy fetch properties for now...
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final boolean isInstance(Object object) {
|
public final boolean isInstance(Object object) {
|
||||||
return getInstantiator().isInstance( object );
|
return getInstantiator().isInstance( object );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasProxy() {
|
public boolean hasProxy() {
|
||||||
return entityMetamodel.isLazy();
|
return entityMetamodel.isLazy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final Object createProxy(Serializable id, SessionImplementor session)
|
public final Object createProxy(Serializable id, SessionImplementor session)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
return getProxyFactory().getProxy( id, session );
|
return getProxyFactory().getProxy( id, session );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isLifecycleImplementor() {
|
public boolean isLifecycleImplementor() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -783,10 +797,12 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
||||||
return getClass().getName() + '(' + getEntityMetamodel().getName() + ')';
|
return getClass().getName() + '(' + getEntityMetamodel().getName() + ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Getter getIdentifierGetter() {
|
public Getter getIdentifierGetter() {
|
||||||
return idGetter;
|
return idGetter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Getter getVersionGetter() {
|
public Getter getVersionGetter() {
|
||||||
if ( getEntityMetamodel().isVersioned() ) {
|
if ( getEntityMetamodel().isVersioned() ) {
|
||||||
return getGetter( getEntityMetamodel().getVersionPropertyIndex() );
|
return getGetter( getEntityMetamodel().getVersionPropertyIndex() );
|
||||||
|
@ -794,6 +810,7 @@ public abstract class AbstractEntityTuplizer implements EntityTuplizer {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Getter getGetter(int i) {
|
public Getter getGetter(int i) {
|
||||||
return getters[i];
|
return getters[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.hibernate.EntityMode;
|
||||||
import org.hibernate.EntityNameResolver;
|
import org.hibernate.EntityNameResolver;
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
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.mapping.PersistentClass;
|
import org.hibernate.mapping.PersistentClass;
|
||||||
import org.hibernate.mapping.Property;
|
import org.hibernate.mapping.Property;
|
||||||
|
@ -43,8 +44,6 @@ import org.hibernate.proxy.map.MapProxyFactory;
|
||||||
import org.hibernate.tuple.DynamicMapInstantiator;
|
import org.hibernate.tuple.DynamicMapInstantiator;
|
||||||
import org.hibernate.tuple.Instantiator;
|
import org.hibernate.tuple.Instantiator;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An {@link EntityTuplizer} specific to the dynamic-map entity mode.
|
* An {@link EntityTuplizer} specific to the dynamic-map entity mode.
|
||||||
*
|
*
|
||||||
|
@ -52,9 +51,7 @@ import org.jboss.logging.Logger;
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
public class DynamicMapEntityTuplizer extends AbstractEntityTuplizer {
|
public class DynamicMapEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
|
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( DynamicMapEntityTuplizer.class );
|
||||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class,
|
|
||||||
DynamicMapEntityTuplizer.class.getName());
|
|
||||||
|
|
||||||
DynamicMapEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) {
|
DynamicMapEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappedEntity) {
|
||||||
super(entityMetamodel, mappedEntity);
|
super(entityMetamodel, mappedEntity);
|
||||||
|
@ -64,9 +61,7 @@ public class DynamicMapEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
super(entityMetamodel, mappedEntity);
|
super(entityMetamodel, mappedEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public EntityMode getEntityMode() {
|
public EntityMode getEntityMode() {
|
||||||
return EntityMode.MAP;
|
return EntityMode.MAP;
|
||||||
}
|
}
|
||||||
|
@ -80,33 +75,21 @@ public class DynamicMapEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Getter buildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity) {
|
protected Getter buildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity) {
|
||||||
return buildPropertyAccessor(mappedProperty).getGetter( null, mappedProperty.getName() );
|
return buildPropertyAccessor(mappedProperty).getGetter( null, mappedProperty.getName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Setter buildPropertySetter(Property mappedProperty, PersistentClass mappedEntity) {
|
protected Setter buildPropertySetter(Property mappedProperty, PersistentClass mappedEntity) {
|
||||||
return buildPropertyAccessor(mappedProperty).getSetter( null, mappedProperty.getName() );
|
return buildPropertyAccessor(mappedProperty).getSetter( null, mappedProperty.getName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Instantiator buildInstantiator(PersistentClass mappingInfo) {
|
protected Instantiator buildInstantiator(PersistentClass mappingInfo) {
|
||||||
return new DynamicMapInstantiator( mappingInfo );
|
return new DynamicMapInstantiator( mappingInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected ProxyFactory buildProxyFactory(PersistentClass mappingInfo, Getter idGetter, Setter idSetter) {
|
protected ProxyFactory buildProxyFactory(PersistentClass mappingInfo, Getter idGetter, Setter idSetter) {
|
||||||
|
|
||||||
|
@ -139,33 +122,21 @@ public class DynamicMapEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Getter buildPropertyGetter(AttributeBinding mappedProperty) {
|
protected Getter buildPropertyGetter(AttributeBinding mappedProperty) {
|
||||||
return buildPropertyAccessor( mappedProperty ).getGetter( null, mappedProperty.getAttribute().getName() );
|
return buildPropertyAccessor( mappedProperty ).getGetter( null, mappedProperty.getAttribute().getName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Setter buildPropertySetter(AttributeBinding mappedProperty) {
|
protected Setter buildPropertySetter(AttributeBinding mappedProperty) {
|
||||||
return buildPropertyAccessor( mappedProperty ).getSetter( null, mappedProperty.getAttribute().getName() );
|
return buildPropertyAccessor( mappedProperty ).getSetter( null, mappedProperty.getAttribute().getName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Instantiator buildInstantiator(EntityBinding mappingInfo) {
|
protected Instantiator buildInstantiator(EntityBinding mappingInfo) {
|
||||||
return new DynamicMapInstantiator( mappingInfo );
|
return new DynamicMapInstantiator( mappingInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected ProxyFactory buildProxyFactory(EntityBinding mappingInfo, Getter idGetter, Setter idSetter) {
|
protected ProxyFactory buildProxyFactory(EntityBinding mappingInfo, Getter idGetter, Setter idSetter) {
|
||||||
|
|
||||||
|
@ -188,37 +159,27 @@ public class DynamicMapEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
return pf;
|
return pf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Class getMappedClass() {
|
public Class getMappedClass() {
|
||||||
return Map.class;
|
return Map.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Class getConcreteProxyClass() {
|
public Class getConcreteProxyClass() {
|
||||||
return Map.class;
|
return Map.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isInstrumented() {
|
public boolean isInstrumented() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public EntityNameResolver[] getEntityNameResolvers() {
|
public EntityNameResolver[] getEntityNameResolvers() {
|
||||||
return new EntityNameResolver[] { BasicEntityNameResolver.INSTANCE };
|
return new EntityNameResolver[] { BasicEntityNameResolver.INSTANCE };
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory) {
|
public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory) {
|
||||||
return extractEmbeddedEntityName( ( Map ) entityInstance );
|
return extractEmbeddedEntityName( ( Map ) entityInstance );
|
||||||
}
|
}
|
||||||
|
@ -230,9 +191,7 @@ public class DynamicMapEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
public static class BasicEntityNameResolver implements EntityNameResolver {
|
public static class BasicEntityNameResolver implements EntityNameResolver {
|
||||||
public static final BasicEntityNameResolver INSTANCE = new BasicEntityNameResolver();
|
public static final BasicEntityNameResolver INSTANCE = new BasicEntityNameResolver();
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String resolveEntityName(Object entity) {
|
public String resolveEntityName(Object entity) {
|
||||||
if ( ! Map.class.isInstance( entity ) ) {
|
if ( ! Map.class.isInstance( entity ) ) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -244,17 +203,11 @@ public class DynamicMapEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
return entityName;
|
return entityName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
return getClass().equals( obj.getClass() );
|
return getClass().equals( obj.getClass() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return getClass().hashCode();
|
return getClass().hashCode();
|
||||||
|
|
|
@ -42,6 +42,7 @@ import org.hibernate.cfg.Environment;
|
||||||
import org.hibernate.classic.Lifecycle;
|
import org.hibernate.classic.Lifecycle;
|
||||||
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
import org.hibernate.engine.spi.SessionFactoryImplementor;
|
||||||
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.mapping.PersistentClass;
|
import org.hibernate.mapping.PersistentClass;
|
||||||
|
@ -59,8 +60,6 @@ import org.hibernate.tuple.Instantiator;
|
||||||
import org.hibernate.tuple.PojoInstantiator;
|
import org.hibernate.tuple.PojoInstantiator;
|
||||||
import org.hibernate.type.CompositeType;
|
import org.hibernate.type.CompositeType;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An {@link EntityTuplizer} specific to the pojo entity mode.
|
* An {@link EntityTuplizer} specific to the pojo entity mode.
|
||||||
*
|
*
|
||||||
|
@ -68,8 +67,7 @@ import org.jboss.logging.Logger;
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
*/
|
*/
|
||||||
public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
|
private static final CoreMessageLogger LOG = CoreLogging.messageLogger( PojoEntityTuplizer.class );
|
||||||
private static final CoreMessageLogger LOG = Logger.getMessageLogger(CoreMessageLogger.class, PojoEntityTuplizer.class.getName());
|
|
||||||
|
|
||||||
private final Class mappedClass;
|
private final Class mappedClass;
|
||||||
private final Class proxyInterface;
|
private final Class proxyInterface;
|
||||||
|
@ -151,9 +149,6 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected ProxyFactory buildProxyFactory(PersistentClass persistentClass, Getter idGetter, Setter idSetter) {
|
protected ProxyFactory buildProxyFactory(PersistentClass persistentClass, Getter idGetter, Setter idSetter) {
|
||||||
// determine the id getter and setter methods from the proxy interface (if any)
|
// determine the id getter and setter methods from the proxy interface (if any)
|
||||||
|
@ -250,9 +245,6 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
// return getFactory().getSettings().getBytecodeProvider().getProxyFactoryFactory().buildProxyFactory();
|
// return getFactory().getSettings().getBytecodeProvider().getProxyFactoryFactory().buildProxyFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Instantiator buildInstantiator(PersistentClass persistentClass) {
|
protected Instantiator buildInstantiator(PersistentClass persistentClass) {
|
||||||
if ( optimizer == null ) {
|
if ( optimizer == null ) {
|
||||||
|
@ -263,9 +255,6 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected ProxyFactory buildProxyFactory(EntityBinding entityBinding, Getter idGetter, Setter idSetter) {
|
protected ProxyFactory buildProxyFactory(EntityBinding entityBinding, Getter idGetter, Setter idSetter) {
|
||||||
// determine the id getter and setter methods from the proxy interface (if any)
|
// determine the id getter and setter methods from the proxy interface (if any)
|
||||||
|
@ -354,9 +343,6 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
// return getFactory().getSettings().getBytecodeProvider().getProxyFactoryFactory().buildProxyFactory();
|
// return getFactory().getSettings().getBytecodeProvider().getProxyFactoryFactory().buildProxyFactory();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Instantiator buildInstantiator(EntityBinding entityBinding) {
|
protected Instantiator buildInstantiator(EntityBinding entityBinding) {
|
||||||
if ( optimizer == null ) {
|
if ( optimizer == null ) {
|
||||||
|
@ -367,9 +353,6 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void setPropertyValues(Object entity, Object[] values) throws HibernateException {
|
public void setPropertyValues(Object entity, Object[] values) throws HibernateException {
|
||||||
if ( !getEntityMetamodel().hasLazyProperties() && optimizer != null && optimizer.getAccessOptimizer() != null ) {
|
if ( !getEntityMetamodel().hasLazyProperties() && optimizer != null && optimizer.getAccessOptimizer() != null ) {
|
||||||
|
@ -380,9 +363,6 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] getPropertyValues(Object entity) throws HibernateException {
|
public Object[] getPropertyValues(Object entity) throws HibernateException {
|
||||||
if ( shouldGetAllProperties( entity ) && optimizer != null && optimizer.getAccessOptimizer() != null ) {
|
if ( shouldGetAllProperties( entity ) && optimizer != null && optimizer.getAccessOptimizer() != null ) {
|
||||||
|
@ -393,9 +373,6 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SessionImplementor session) throws HibernateException {
|
public Object[] getPropertyValuesToInsert(Object entity, Map mergeMap, SessionImplementor session) throws HibernateException {
|
||||||
if ( shouldGetAllProperties( entity ) && optimizer != null && optimizer.getAccessOptimizer() != null ) {
|
if ( shouldGetAllProperties( entity ) && optimizer != null && optimizer.getAccessOptimizer() != null ) {
|
||||||
|
@ -414,55 +391,36 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
return optimizer.getAccessOptimizer().getPropertyValues( object );
|
return optimizer.getAccessOptimizer().getPropertyValues( object );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public EntityMode getEntityMode() {
|
public EntityMode getEntityMode() {
|
||||||
return EntityMode.POJO;
|
return EntityMode.POJO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Class getMappedClass() {
|
public Class getMappedClass() {
|
||||||
return mappedClass;
|
return mappedClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isLifecycleImplementor() {
|
public boolean isLifecycleImplementor() {
|
||||||
return lifecycleImplementor;
|
return lifecycleImplementor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Getter buildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity) {
|
protected Getter buildPropertyGetter(Property mappedProperty, PersistentClass mappedEntity) {
|
||||||
return mappedProperty.getGetter( mappedEntity.getMappedClass() );
|
return mappedProperty.getGetter( mappedEntity.getMappedClass() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Setter buildPropertySetter(Property mappedProperty, PersistentClass mappedEntity) {
|
protected Setter buildPropertySetter(Property mappedProperty, PersistentClass mappedEntity) {
|
||||||
return mappedProperty.getSetter( mappedEntity.getMappedClass() );
|
return mappedProperty.getSetter( mappedEntity.getMappedClass() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Getter buildPropertyGetter(AttributeBinding mappedProperty) {
|
protected Getter buildPropertyGetter(AttributeBinding mappedProperty) {
|
||||||
return getGetter( mappedProperty );
|
return getGetter( mappedProperty );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
protected Setter buildPropertySetter(AttributeBinding mappedProperty) {
|
protected Setter buildPropertySetter(AttributeBinding mappedProperty) {
|
||||||
return getSetter( mappedProperty );
|
return getSetter( mappedProperty );
|
||||||
|
@ -490,18 +448,13 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Class getConcreteProxyClass() {
|
public Class getConcreteProxyClass() {
|
||||||
return proxyInterface;
|
return proxyInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: need to make the majority of this functionality into a top-level support class for custom impl support
|
//TODO: need to make the majority of this functionality into a top-level support class for custom impl support
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void afterInitialize(Object entity, boolean lazyPropertiesAreUnfetched, SessionImplementor session) {
|
public void afterInitialize(Object entity, boolean lazyPropertiesAreUnfetched, SessionImplementor session) {
|
||||||
if ( isInstrumented() ) {
|
if ( isInstrumented() ) {
|
||||||
|
@ -518,9 +471,6 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasUninitializedLazyProperties(Object entity) {
|
public boolean hasUninitializedLazyProperties(Object entity) {
|
||||||
if ( getEntityMetamodel().hasLazyProperties() ) {
|
if ( getEntityMetamodel().hasLazyProperties() ) {
|
||||||
|
@ -532,16 +482,12 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isInstrumented() {
|
public boolean isInstrumented() {
|
||||||
return isInstrumented;
|
return isInstrumented;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory) {
|
public String determineConcreteSubclassEntityName(Object entityInstance, SessionFactoryImplementor factory) {
|
||||||
final Class concreteEntityClass = entityInstance.getClass();
|
final Class concreteEntityClass = entityInstance.getClass();
|
||||||
if ( concreteEntityClass == getMappedClass() ) {
|
if ( concreteEntityClass == getMappedClass() ) {
|
||||||
|
@ -559,9 +505,7 @@ public class PojoEntityTuplizer extends AbstractEntityTuplizer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public EntityNameResolver[] getEntityNameResolvers() {
|
public EntityNameResolver[] getEntityNameResolvers() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,9 +42,7 @@ public class BigDecimalType extends AbstractSingleColumnStandardBasicType<BigDec
|
||||||
super( NumericTypeDescriptor.INSTANCE, BigDecimalTypeDescriptor.INSTANCE );
|
super( NumericTypeDescriptor.INSTANCE, BigDecimalTypeDescriptor.INSTANCE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "big_decimal";
|
return "big_decimal";
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,9 +46,7 @@ public class BigIntegerType
|
||||||
super( NumericTypeDescriptor.INSTANCE, BigIntegerTypeDescriptor.INSTANCE );
|
super( NumericTypeDescriptor.INSTANCE, BigIntegerTypeDescriptor.INSTANCE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "big_integer";
|
return "big_integer";
|
||||||
}
|
}
|
||||||
|
@ -58,16 +56,12 @@ public class BigIntegerType
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String objectToSQLString(BigInteger value, Dialect dialect) {
|
public String objectToSQLString(BigInteger value, Dialect dialect) {
|
||||||
return BigIntegerTypeDescriptor.INSTANCE.toString( value );
|
return BigIntegerTypeDescriptor.INSTANCE.toString( value );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public BigInteger stringToObject(String string) {
|
public BigInteger stringToObject(String string) {
|
||||||
return BigIntegerTypeDescriptor.INSTANCE.fromString( string );
|
return BigIntegerTypeDescriptor.INSTANCE.fromString( string );
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,9 +40,7 @@ public class BlobType extends AbstractSingleColumnStandardBasicType<Blob> {
|
||||||
super( org.hibernate.type.descriptor.sql.BlobTypeDescriptor.DEFAULT, BlobTypeDescriptor.INSTANCE );
|
super( org.hibernate.type.descriptor.sql.BlobTypeDescriptor.DEFAULT, BlobTypeDescriptor.INSTANCE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "blob";
|
return "blob";
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,6 +103,7 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
this.isEmbeddedInXML = true;
|
this.isEmbeddedInXML = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isEmbeddedInXML() {
|
public boolean isEmbeddedInXML() {
|
||||||
return isEmbeddedInXML;
|
return isEmbeddedInXML;
|
||||||
}
|
}
|
||||||
|
@ -131,20 +132,24 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isCollectionType() {
|
public boolean isCollectionType() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final boolean isEqual(Object x, Object y) {
|
public final boolean isEqual(Object x, Object y) {
|
||||||
return x == y
|
return x == y
|
||||||
|| ( x instanceof PersistentCollection && ( (PersistentCollection) x ).isWrapper( y ) )
|
|| ( x instanceof PersistentCollection && ( (PersistentCollection) x ).isWrapper( y ) )
|
||||||
|| ( y instanceof PersistentCollection && ( (PersistentCollection) y ).isWrapper( x ) );
|
|| ( y instanceof PersistentCollection && ( (PersistentCollection) y ).isWrapper( x ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int compare(Object x, Object y) {
|
public int compare(Object x, Object y) {
|
||||||
return 0; // collections cannot be compared
|
return 0; // collections cannot be compared
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getHashCode(Object x) {
|
public int getHashCode(Object x) {
|
||||||
throw new UnsupportedOperationException( "cannot doAfterTransactionCompletion lookups on collections" );
|
throw new UnsupportedOperationException( "cannot doAfterTransactionCompletion lookups on collections" );
|
||||||
}
|
}
|
||||||
|
@ -160,24 +165,29 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
*/
|
*/
|
||||||
public abstract PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key);
|
public abstract PersistentCollection instantiate(SessionImplementor session, CollectionPersister persister, Serializable key);
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object nullSafeGet(ResultSet rs, String name, SessionImplementor session, Object owner) throws SQLException {
|
public Object nullSafeGet(ResultSet rs, String name, SessionImplementor session, Object owner) throws SQLException {
|
||||||
return nullSafeGet( rs, new String[] { name }, session, owner );
|
return nullSafeGet( rs, new String[] { name }, session, owner );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object nullSafeGet(ResultSet rs, String[] name, SessionImplementor session, Object owner)
|
public Object nullSafeGet(ResultSet rs, String[] name, SessionImplementor session, Object owner)
|
||||||
throws HibernateException, SQLException {
|
throws HibernateException, SQLException {
|
||||||
return resolve( null, session, owner );
|
return resolve( null, session, owner );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void nullSafeSet(PreparedStatement st, Object value, int index, boolean[] settable,
|
public final void nullSafeSet(PreparedStatement st, Object value, int index, boolean[] settable,
|
||||||
SessionImplementor session) throws HibernateException, SQLException {
|
SessionImplementor session) throws HibernateException, SQLException {
|
||||||
//NOOP
|
//NOOP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void nullSafeSet(PreparedStatement st, Object value, int index,
|
public void nullSafeSet(PreparedStatement st, Object value, int index,
|
||||||
SessionImplementor session) throws HibernateException, SQLException {
|
SessionImplementor session) throws HibernateException, SQLException {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int[] sqlTypes(Mapping session) throws MappingException {
|
public int[] sqlTypes(Mapping session) throws MappingException {
|
||||||
return ArrayHelper.EMPTY_INT_ARRAY;
|
return ArrayHelper.EMPTY_INT_ARRAY;
|
||||||
}
|
}
|
||||||
|
@ -192,10 +202,12 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
return new Size[] { LEGACY_DEFAULT_SIZE };
|
return new Size[] { LEGACY_DEFAULT_SIZE };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getColumnSpan(Mapping session) throws MappingException {
|
public int getColumnSpan(Mapping session) throws MappingException {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toLoggableString(Object value, SessionFactoryImplementor factory)
|
public String toLoggableString(Object value, SessionFactoryImplementor factory)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
|
@ -219,11 +231,13 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
return list.toString();
|
return list.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object deepCopy(Object value, SessionFactoryImplementor factory)
|
public Object deepCopy(Object value, SessionFactoryImplementor factory)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return getReturnedClass().getName() + '(' + getRole() + ')';
|
return getReturnedClass().getName() + '(' + getRole() + ')';
|
||||||
}
|
}
|
||||||
|
@ -249,10 +263,12 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
return ( (Collection) collection ).iterator();
|
return ( (Collection) collection ).iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isMutable() {
|
public boolean isMutable() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Serializable disassemble(Object value, SessionImplementor session, Object owner)
|
public Serializable disassemble(Object value, SessionImplementor session, Object owner)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
//remember the uk value
|
//remember the uk value
|
||||||
|
@ -272,6 +288,7 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object assemble(Serializable cached, SessionImplementor session, Object owner)
|
public Object assemble(Serializable cached, SessionImplementor session, Object owner)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
//we must use the "remembered" uk value, since it is
|
//we must use the "remembered" uk value, since it is
|
||||||
|
@ -309,6 +326,7 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
return session.getFactory().getCollectionPersister( role );
|
return session.getFactory().getCollectionPersister( role );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isDirty(Object old, Object current, SessionImplementor session)
|
public boolean isDirty(Object old, Object current, SessionImplementor session)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
|
|
||||||
|
@ -321,6 +339,7 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isDirty(Object old, Object current, boolean[] checkable, SessionImplementor session)
|
public boolean isDirty(Object old, Object current, boolean[] checkable, SessionImplementor session)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
return isDirty(old, current, session);
|
return isDirty(old, current, session);
|
||||||
|
@ -340,10 +359,12 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
* Note: return true because this type is castable to <tt>AssociationType</tt>. Not because
|
* Note: return true because this type is castable to <tt>AssociationType</tt>. Not because
|
||||||
* all collections are associations.
|
* all collections are associations.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isAssociationType() {
|
public boolean isAssociationType() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public ForeignKeyDirection getForeignKeyDirection() {
|
public ForeignKeyDirection getForeignKeyDirection() {
|
||||||
return ForeignKeyDirection.FOREIGN_KEY_TO_PARENT;
|
return ForeignKeyDirection.FOREIGN_KEY_TO_PARENT;
|
||||||
}
|
}
|
||||||
|
@ -425,12 +446,14 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
return ownerId;
|
return ownerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object hydrate(ResultSet rs, String[] name, SessionImplementor session, Object owner) {
|
public Object hydrate(ResultSet rs, String[] name, SessionImplementor session, Object owner) {
|
||||||
// can't just return null here, since that would
|
// can't just return null here, since that would
|
||||||
// cause an owning component to become null
|
// cause an owning component to become null
|
||||||
return NOT_NULL_COLLECTION;
|
return NOT_NULL_COLLECTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object resolve(Object value, SessionImplementor session, Object owner)
|
public Object resolve(Object value, SessionImplementor session, Object owner)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
|
|
||||||
|
@ -444,6 +467,7 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
getCollection( key, session, owner );
|
getCollection( key, session, owner );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object semiResolve(Object value, SessionImplementor session, Object owner)
|
public Object semiResolve(Object value, SessionImplementor session, Object owner)
|
||||||
throws HibernateException {
|
throws HibernateException {
|
||||||
throw new UnsupportedOperationException(
|
throw new UnsupportedOperationException(
|
||||||
|
@ -454,23 +478,28 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean useLHSPrimaryKey() {
|
public boolean useLHSPrimaryKey() {
|
||||||
return foreignKeyPropertyName == null;
|
return foreignKeyPropertyName == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getRHSUniqueKeyPropertyName() {
|
public String getRHSUniqueKeyPropertyName() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Joinable getAssociatedJoinable(SessionFactoryImplementor factory)
|
public Joinable getAssociatedJoinable(SessionFactoryImplementor factory)
|
||||||
throws MappingException {
|
throws MappingException {
|
||||||
return (Joinable) factory.getCollectionPersister( role );
|
return (Joinable) factory.getCollectionPersister( role );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isModified(Object old, Object current, boolean[] checkable, SessionImplementor session) throws HibernateException {
|
public boolean isModified(Object old, Object current, boolean[] checkable, SessionImplementor session) throws HibernateException {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getAssociatedEntityName(SessionFactoryImplementor factory)
|
public String getAssociatedEntityName(SessionFactoryImplementor factory)
|
||||||
throws MappingException {
|
throws MappingException {
|
||||||
try {
|
try {
|
||||||
|
@ -638,9 +667,7 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
*/
|
*/
|
||||||
public abstract Object instantiate(int anticipatedSize);
|
public abstract Object instantiate(int anticipatedSize);
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object replace(
|
public Object replace(
|
||||||
final Object original,
|
final Object original,
|
||||||
final Object target,
|
final Object target,
|
||||||
|
@ -688,10 +715,12 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
return factory.getCollectionPersister( getRole() ).getElementType();
|
return factory.getCollectionPersister( getRole() ).getElementType();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getClass().getName() + '(' + getRole() + ')';
|
return getClass().getName() + '(' + getRole() + ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getOnCondition(String alias, SessionFactoryImplementor factory, Map enabledFilters)
|
public String getOnCondition(String alias, SessionFactoryImplementor factory, Map enabledFilters)
|
||||||
throws MappingException {
|
throws MappingException {
|
||||||
return getAssociatedJoinable( factory ).filterFragment( alias, enabledFilters );
|
return getAssociatedJoinable( factory ).filterFragment( alias, enabledFilters );
|
||||||
|
@ -771,20 +800,24 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getLHSPropertyName() {
|
public String getLHSPropertyName() {
|
||||||
return foreignKeyPropertyName;
|
return foreignKeyPropertyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isXMLElement() {
|
public boolean isXMLElement() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Object fromXMLNode(Node xml, Mapping factory) throws HibernateException {
|
public Object fromXMLNode(Node xml, Mapping factory) throws HibernateException {
|
||||||
return xml;
|
return xml;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory)
|
@Override
|
||||||
throws HibernateException {
|
public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory)
|
||||||
|
throws HibernateException {
|
||||||
if ( !isEmbeddedInXML ) {
|
if ( !isEmbeddedInXML ) {
|
||||||
node.detach();
|
node.detach();
|
||||||
}
|
}
|
||||||
|
@ -798,10 +831,12 @@ public abstract class CollectionType extends AbstractType implements Association
|
||||||
* need to incremement version number of owner and also because of
|
* need to incremement version number of owner and also because of
|
||||||
* how assemble/disassemble is implemented for uks
|
* how assemble/disassemble is implemented for uks
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isAlwaysDirtyChecked() {
|
public boolean isAlwaysDirtyChecked() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean[] toColumnNullness(Object value, Mapping mapping) {
|
public boolean[] toColumnNullness(Object value, Mapping mapping) {
|
||||||
return ArrayHelper.EMPTY_BOOLEAN_ARRAY;
|
return ArrayHelper.EMPTY_BOOLEAN_ARRAY;
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,6 +155,7 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
*
|
*
|
||||||
* @return True.
|
* @return True.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public boolean isAssociationType() {
|
public boolean isAssociationType() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -164,13 +165,12 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
*
|
*
|
||||||
* @return True.
|
* @return True.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final boolean isEntityType() {
|
public final boolean isEntityType() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isMutable() {
|
public boolean isMutable() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -180,6 +180,7 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
*
|
*
|
||||||
* @return string rep
|
* @return string rep
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getClass().getName() + '(' + getAssociatedEntityName() + ')';
|
return getClass().getName() + '(' + getAssociatedEntityName() + ')';
|
||||||
}
|
}
|
||||||
|
@ -187,6 +188,7 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
/**
|
/**
|
||||||
* For entity types, the name correlates to the associated entity name.
|
* For entity types, the name correlates to the associated entity name.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return associatedEntityName;
|
return associatedEntityName;
|
||||||
}
|
}
|
||||||
|
@ -201,12 +203,14 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
return referenceToPrimaryKey;
|
return referenceToPrimaryKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getRHSUniqueKeyPropertyName() {
|
public String getRHSUniqueKeyPropertyName() {
|
||||||
// Return null if this type references a PK. This is important for
|
// Return null if this type references a PK. This is important for
|
||||||
// associations' use of mappedBy referring to a derived ID.
|
// associations' use of mappedBy referring to a derived ID.
|
||||||
return referenceToPrimaryKey ? null : uniqueKeyPropertyName;
|
return referenceToPrimaryKey ? null : uniqueKeyPropertyName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String getLHSPropertyName() {
|
public String getLHSPropertyName() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -230,6 +234,7 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
* @param factory The session factory, for resolution.
|
* @param factory The session factory, for resolution.
|
||||||
* @return The associated entity name.
|
* @return The associated entity name.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String getAssociatedEntityName(SessionFactoryImplementor factory) {
|
public String getAssociatedEntityName(SessionFactoryImplementor factory) {
|
||||||
return getAssociatedEntityName();
|
return getAssociatedEntityName();
|
||||||
}
|
}
|
||||||
|
@ -241,6 +246,7 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
* @return The associated joinable
|
* @return The associated joinable
|
||||||
* @throws MappingException Generally indicates an invalid entity name.
|
* @throws MappingException Generally indicates an invalid entity name.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Joinable getAssociatedJoinable(SessionFactoryImplementor factory) throws MappingException {
|
public Joinable getAssociatedJoinable(SessionFactoryImplementor factory) throws MappingException {
|
||||||
return ( Joinable ) factory.getEntityPersister( associatedEntityName );
|
return ( Joinable ) factory.getEntityPersister( associatedEntityName );
|
||||||
}
|
}
|
||||||
|
@ -255,6 +261,7 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
*
|
*
|
||||||
* @return The entiyt class.
|
* @return The entiyt class.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final Class getReturnedClass() {
|
public final Class getReturnedClass() {
|
||||||
if ( returnedClass == null ) {
|
if ( returnedClass == null ) {
|
||||||
returnedClass = determineAssociatedEntityClass();
|
returnedClass = determineAssociatedEntityClass();
|
||||||
|
@ -273,17 +280,13 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object nullSafeGet(ResultSet rs, String name, SessionImplementor session, Object owner)
|
public Object nullSafeGet(ResultSet rs, String name, SessionImplementor session, Object owner)
|
||||||
throws HibernateException, SQLException {
|
throws HibernateException, SQLException {
|
||||||
return nullSafeGet( rs, new String[] {name}, session, owner );
|
return nullSafeGet( rs, new String[] {name}, session, owner );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public final Object nullSafeGet(
|
public final Object nullSafeGet(
|
||||||
ResultSet rs,
|
ResultSet rs,
|
||||||
String[] names,
|
String[] names,
|
||||||
|
@ -300,27 +303,22 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
* @param y Another entity instance
|
* @param y Another entity instance
|
||||||
* @return True if x == y; false otherwise.
|
* @return True if x == y; false otherwise.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final boolean isSame(Object x, Object y) {
|
public final boolean isSame(Object x, Object y) {
|
||||||
return x == y;
|
return x == y;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public int compare(Object x, Object y) {
|
public int compare(Object x, Object y) {
|
||||||
return 0; //TODO: entities CAN be compared, by PK, fix this! -> only if/when we can extract the id values....
|
return 0; //TODO: entities CAN be compared, by PK, fix this! -> only if/when we can extract the id values....
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object deepCopy(Object value, SessionFactoryImplementor factory) {
|
public Object deepCopy(Object value, SessionFactoryImplementor factory) {
|
||||||
return value; //special case ... this is the leaf of the containment graph, even though not immutable
|
return value; //special case ... this is the leaf of the containment graph, even though not immutable
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object replace(
|
public Object replace(
|
||||||
Object original,
|
Object original,
|
||||||
Object target,
|
Object target,
|
||||||
|
@ -357,9 +355,7 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public int getHashCode(Object x, SessionFactoryImplementor factory) {
|
public int getHashCode(Object x, SessionFactoryImplementor factory) {
|
||||||
EntityPersister persister = factory.getEntityPersister(associatedEntityName);
|
EntityPersister persister = factory.getEntityPersister(associatedEntityName);
|
||||||
if ( !persister.canExtractIdOutOfEntity() ) {
|
if ( !persister.canExtractIdOutOfEntity() ) {
|
||||||
|
@ -429,23 +425,17 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
.isEqual(xid, yid, factory);
|
.isEqual(xid, yid, factory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isEmbeddedInXML() {
|
public boolean isEmbeddedInXML() {
|
||||||
return isEmbeddedInXML;
|
return isEmbeddedInXML;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isXMLElement() {
|
public boolean isXMLElement() {
|
||||||
return isEmbeddedInXML;
|
return isEmbeddedInXML;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object fromXMLNode(Node xml, Mapping factory) throws HibernateException {
|
public Object fromXMLNode(Node xml, Mapping factory) throws HibernateException {
|
||||||
if ( !isEmbeddedInXML ) {
|
if ( !isEmbeddedInXML ) {
|
||||||
return getIdentifierType(factory).fromXMLNode(xml, factory);
|
return getIdentifierType(factory).fromXMLNode(xml, factory);
|
||||||
|
@ -455,9 +445,7 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory) throws HibernateException {
|
public void setToXMLNode(Node node, Object value, SessionFactoryImplementor factory) throws HibernateException {
|
||||||
if ( !isEmbeddedInXML ) {
|
if ( !isEmbeddedInXML ) {
|
||||||
getIdentifierType(factory).setToXMLNode(node, value, factory);
|
getIdentifierType(factory).setToXMLNode(node, value, factory);
|
||||||
|
@ -490,6 +478,7 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
/**
|
/**
|
||||||
* Resolve an identifier or unique key value
|
* Resolve an identifier or unique key value
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public Object resolve(Object value, SessionImplementor session, Object owner) throws HibernateException {
|
public Object resolve(Object value, SessionImplementor session, Object owner) throws HibernateException {
|
||||||
if ( isNotEmbedded( session ) ) {
|
if ( isNotEmbedded( session ) ) {
|
||||||
return value;
|
return value;
|
||||||
|
@ -507,6 +496,7 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public Type getSemiResolvedType(SessionFactoryImplementor factory) {
|
public Type getSemiResolvedType(SessionFactoryImplementor factory) {
|
||||||
return factory.getEntityPersister( associatedEntityName ).getIdentifierType();
|
return factory.getEntityPersister( associatedEntityName ).getIdentifierType();
|
||||||
}
|
}
|
||||||
|
@ -555,6 +545,7 @@ public abstract class EntityType extends AbstractType implements AssociationType
|
||||||
* @return The loggable string.
|
* @return The loggable string.
|
||||||
* @throws HibernateException Generally some form of resolution problem.
|
* @throws HibernateException Generally some form of resolution problem.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public String toLoggableString(Object value, SessionFactoryImplementor factory) {
|
public String toLoggableString(Object value, SessionFactoryImplementor factory) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return "null";
|
return "null";
|
||||||
|
|
|
@ -50,9 +50,7 @@ public class OrderedMapType extends MapType {
|
||||||
super( typeScope, role, propertyRef );
|
super( typeScope, role, propertyRef );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object instantiate(int anticipatedSize) {
|
public Object instantiate(int anticipatedSize) {
|
||||||
return anticipatedSize > 0
|
return anticipatedSize > 0
|
||||||
? new LinkedHashMap( anticipatedSize )
|
? new LinkedHashMap( anticipatedSize )
|
||||||
|
|
|
@ -51,9 +51,7 @@ public class OrderedSetType extends SetType {
|
||||||
super( typeScope, role, propertyRef );
|
super( typeScope, role, propertyRef );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object instantiate(int anticipatedSize) {
|
public Object instantiate(int anticipatedSize) {
|
||||||
return anticipatedSize > 0
|
return anticipatedSize > 0
|
||||||
? new LinkedHashSet( anticipatedSize )
|
? new LinkedHashSet( anticipatedSize )
|
||||||
|
|
|
@ -41,24 +41,16 @@ public class SerializableToBlobType<T extends Serializable> extends AbstractSing
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param sqlTypeDescriptor
|
|
||||||
* @param javaTypeDescriptor
|
|
||||||
*/
|
|
||||||
public SerializableToBlobType() {
|
public SerializableToBlobType() {
|
||||||
super( BlobTypeDescriptor.DEFAULT, new SerializableTypeDescriptor( Serializable.class ) );
|
super( BlobTypeDescriptor.DEFAULT, new SerializableTypeDescriptor( Serializable.class ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return getClass().getName();
|
return getClass().getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void setParameterValues(Properties parameters) {
|
public void setParameterValues(Properties parameters) {
|
||||||
ParameterType reader = (ParameterType) parameters.get( PARAMETER_TYPE );
|
ParameterType reader = (ParameterType) parameters.get( PARAMETER_TYPE );
|
||||||
|
|
|
@ -40,10 +40,12 @@ public class BigIntegerTypeDescriptor extends AbstractTypeDescriptor<BigInteger>
|
||||||
super( BigInteger.class );
|
super( BigInteger.class );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString(BigInteger value) {
|
public String toString(BigInteger value) {
|
||||||
return value.toString();
|
return value.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public BigInteger fromString(String string) {
|
public BigInteger fromString(String string) {
|
||||||
return new BigInteger( string );
|
return new BigInteger( string );
|
||||||
}
|
}
|
||||||
|
@ -58,9 +60,7 @@ public class BigIntegerTypeDescriptor extends AbstractTypeDescriptor<BigInteger>
|
||||||
return one == another || ( one != null && another != null && one.compareTo( another ) == 0 );
|
return one == another || ( one != null && another != null && one.compareTo( another ) == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@SuppressWarnings({ "unchecked" })
|
@SuppressWarnings({ "unchecked" })
|
||||||
public <X> X unwrap(BigInteger value, Class<X> type, WrapperOptions options) {
|
public <X> X unwrap(BigInteger value, Class<X> type, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
|
@ -93,9 +93,7 @@ public class BigIntegerTypeDescriptor extends AbstractTypeDescriptor<BigInteger>
|
||||||
throw unknownUnwrap( type );
|
throw unknownUnwrap( type );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public <X> BigInteger wrap(X value, WrapperOptions options) {
|
public <X> BigInteger wrap(X value, WrapperOptions options) {
|
||||||
if ( value == null ) {
|
if ( value == null ) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -71,7 +71,8 @@ public abstract class BlobTypeDescriptor implements SqlTypeDescriptor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected X doExtract(CallableStatement statement, String name, WrapperOptions options) throws SQLException {
|
protected X doExtract(CallableStatement statement, String name, WrapperOptions options)
|
||||||
|
throws SQLException {
|
||||||
return javaTypeDescriptor.wrap( statement.getBlob( name ), options );
|
return javaTypeDescriptor.wrap( statement.getBlob( name ), options );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -79,76 +80,78 @@ public abstract class BlobTypeDescriptor implements SqlTypeDescriptor {
|
||||||
|
|
||||||
protected abstract <X> BasicBinder<X> getBlobBinder(final JavaTypeDescriptor<X> javaTypeDescriptor);
|
protected abstract <X> BasicBinder<X> getBlobBinder(final JavaTypeDescriptor<X> javaTypeDescriptor);
|
||||||
|
|
||||||
|
@Override
|
||||||
public <X> BasicBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
|
public <X> BasicBinder<X> getBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
|
||||||
return getBlobBinder( javaTypeDescriptor );
|
return getBlobBinder( javaTypeDescriptor );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final BlobTypeDescriptor DEFAULT =
|
public static final BlobTypeDescriptor DEFAULT = new BlobTypeDescriptor() {
|
||||||
new BlobTypeDescriptor() {
|
{
|
||||||
{
|
SqlTypeDescriptorRegistry.INSTANCE.addDescriptor( this );
|
||||||
SqlTypeDescriptorRegistry.INSTANCE.addDescriptor( this );
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <X> BasicBinder<X> getBlobBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
|
||||||
|
return new BasicBinder<X>( javaTypeDescriptor, this ) {
|
||||||
@Override
|
@Override
|
||||||
public <X> BasicBinder<X> getBlobBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
|
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options)
|
||||||
return new BasicBinder<X>( javaTypeDescriptor, this ) {
|
throws SQLException {
|
||||||
@Override
|
BlobTypeDescriptor descriptor = BLOB_BINDING;
|
||||||
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException {
|
if ( byte[].class.isInstance( value ) ) {
|
||||||
BlobTypeDescriptor descriptor = BLOB_BINDING;
|
// performance shortcut for binding BLOB data in byte[] format
|
||||||
if ( byte[].class.isInstance( value ) ) {
|
descriptor = PRIMITIVE_ARRAY_BINDING;
|
||||||
// performance shortcut for binding BLOB data in byte[] format
|
}
|
||||||
descriptor = PRIMITIVE_ARRAY_BINDING;
|
else if ( options.useStreamForLobBinding() ) {
|
||||||
}
|
descriptor = STREAM_BINDING;
|
||||||
else if ( options.useStreamForLobBinding() ) {
|
}
|
||||||
descriptor = STREAM_BINDING;
|
descriptor.getBlobBinder( javaTypeDescriptor ).doBind( st, value, index, options );
|
||||||
}
|
|
||||||
descriptor.getBlobBinder( javaTypeDescriptor ).doBind( st, value, index, options );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public static final BlobTypeDescriptor PRIMITIVE_ARRAY_BINDING =
|
public static final BlobTypeDescriptor PRIMITIVE_ARRAY_BINDING = new BlobTypeDescriptor() {
|
||||||
new BlobTypeDescriptor() {
|
@Override
|
||||||
|
public <X> BasicBinder<X> getBlobBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
|
||||||
|
return new BasicBinder<X>( javaTypeDescriptor, this ) {
|
||||||
@Override
|
@Override
|
||||||
public <X> BasicBinder<X> getBlobBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
|
public void doBind(PreparedStatement st, X value, int index, WrapperOptions options)
|
||||||
return new BasicBinder<X>( javaTypeDescriptor, this ) {
|
throws SQLException {
|
||||||
@Override
|
st.setBytes( index, javaTypeDescriptor.unwrap( value, byte[].class, options ) );
|
||||||
public void doBind(PreparedStatement st, X value, int index, WrapperOptions options)
|
|
||||||
throws SQLException {
|
|
||||||
st.setBytes( index, javaTypeDescriptor.unwrap( value, byte[].class, options ) );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public static final BlobTypeDescriptor BLOB_BINDING =
|
public static final BlobTypeDescriptor BLOB_BINDING = new BlobTypeDescriptor() {
|
||||||
new BlobTypeDescriptor() {
|
@Override
|
||||||
|
public <X> BasicBinder<X> getBlobBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
|
||||||
|
return new BasicBinder<X>( javaTypeDescriptor, this ) {
|
||||||
@Override
|
@Override
|
||||||
public <X> BasicBinder<X> getBlobBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
|
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options)
|
||||||
return new BasicBinder<X>( javaTypeDescriptor, this ) {
|
throws SQLException {
|
||||||
@Override
|
st.setBlob( index, javaTypeDescriptor.unwrap( value, Blob.class, options ) );
|
||||||
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options)
|
|
||||||
throws SQLException {
|
|
||||||
st.setBlob( index, javaTypeDescriptor.unwrap( value, Blob.class, options ) );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public static final BlobTypeDescriptor STREAM_BINDING =
|
public static final BlobTypeDescriptor STREAM_BINDING = new BlobTypeDescriptor() {
|
||||||
new BlobTypeDescriptor() {
|
@Override
|
||||||
|
public <X> BasicBinder<X> getBlobBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
|
||||||
|
return new BasicBinder<X>( javaTypeDescriptor, this ) {
|
||||||
@Override
|
@Override
|
||||||
public <X> BasicBinder<X> getBlobBinder(final JavaTypeDescriptor<X> javaTypeDescriptor) {
|
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options)
|
||||||
return new BasicBinder<X>( javaTypeDescriptor, this ) {
|
throws SQLException {
|
||||||
@Override
|
final BinaryStream binaryStream = javaTypeDescriptor.unwrap(
|
||||||
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options)
|
value,
|
||||||
throws SQLException {
|
BinaryStream.class,
|
||||||
final BinaryStream binaryStream = javaTypeDescriptor.unwrap( value, BinaryStream.class, options );
|
options
|
||||||
st.setBinaryStream( index, binaryStream.getInputStream(), binaryStream.getLength() );
|
);
|
||||||
}
|
st.setBinaryStream( index, binaryStream.getInputStream(), binaryStream.getLength() );
|
||||||
};
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ public class HQLTest extends QueryTranslatorTestCase {
|
||||||
protected void prepareTest() throws Exception {
|
protected void prepareTest() throws Exception {
|
||||||
super.prepareTest();
|
super.prepareTest();
|
||||||
SelectClause.VERSION2_SQL = true;
|
SelectClause.VERSION2_SQL = true;
|
||||||
DotNode.REGRESSION_STYLE_JOIN_SUPPRESSION = true;
|
DotNode.regressionStyleJoinSuppression = true;
|
||||||
DotNode.ILLEGAL_COLL_DEREF_EXCP_BUILDER = new DotNode.IllegalCollectionDereferenceExceptionBuilder() {
|
DotNode.ILLEGAL_COLL_DEREF_EXCP_BUILDER = new DotNode.IllegalCollectionDereferenceExceptionBuilder() {
|
||||||
public QueryException buildIllegalCollectionDereferenceException(String propertyName, FromReferenceNode lhs) {
|
public QueryException buildIllegalCollectionDereferenceException(String propertyName, FromReferenceNode lhs) {
|
||||||
throw new QueryException( "illegal syntax near collection: " + propertyName );
|
throw new QueryException( "illegal syntax near collection: " + propertyName );
|
||||||
|
@ -115,7 +115,7 @@ public class HQLTest extends QueryTranslatorTestCase {
|
||||||
@Override
|
@Override
|
||||||
protected void cleanupTest() throws Exception {
|
protected void cleanupTest() throws Exception {
|
||||||
SelectClause.VERSION2_SQL = false;
|
SelectClause.VERSION2_SQL = false;
|
||||||
DotNode.REGRESSION_STYLE_JOIN_SUPPRESSION = false;
|
DotNode.regressionStyleJoinSuppression = false;
|
||||||
DotNode.ILLEGAL_COLL_DEREF_EXCP_BUILDER = DotNode.DEF_ILLEGAL_COLL_DEREF_EXCP_BUILDER;
|
DotNode.ILLEGAL_COLL_DEREF_EXCP_BUILDER = DotNode.DEF_ILLEGAL_COLL_DEREF_EXCP_BUILDER;
|
||||||
SqlGenerator.REGRESSION_STYLE_CROSS_JOINS = false;
|
SqlGenerator.REGRESSION_STYLE_CROSS_JOINS = false;
|
||||||
super.cleanupTest();
|
super.cleanupTest();
|
||||||
|
|
|
@ -541,39 +541,35 @@ public class EntityManagerFactoryBuilderImpl implements EntityManagerFactoryBuil
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
{
|
final String cfgXmlResourceName1 = (String) merged.remove( AvailableSettings.CFG_FILE );
|
||||||
final String cfgXmlResourceName = (String) merged.remove( AvailableSettings.CFG_FILE );
|
if ( StringHelper.isNotEmpty( cfgXmlResourceName1 ) ) {
|
||||||
if ( StringHelper.isNotEmpty( cfgXmlResourceName ) ) {
|
// it does, so load those properties
|
||||||
// it does, so load those properties
|
JaxbHibernateConfiguration configurationElement = configLoaderHolder.getValue()
|
||||||
JaxbHibernateConfiguration configurationElement = configLoaderHolder.getValue()
|
.loadConfigXmlResource( cfgXmlResourceName1 );
|
||||||
.loadConfigXmlResource( cfgXmlResourceName );
|
processHibernateConfigurationElement( configurationElement, merged );
|
||||||
processHibernateConfigurationElement( configurationElement, merged );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// see if integration settings named a Hibernate config file....
|
// see if integration settings named a Hibernate config file....
|
||||||
{
|
final String cfgXmlResourceName2 = (String) integrationSettings.get( AvailableSettings.CFG_FILE );
|
||||||
final String cfgXmlResourceName = (String) integrationSettings.get( AvailableSettings.CFG_FILE );
|
if ( StringHelper.isNotEmpty( cfgXmlResourceName2 ) ) {
|
||||||
if ( StringHelper.isNotEmpty( cfgXmlResourceName ) ) {
|
integrationSettings.remove( AvailableSettings.CFG_FILE );
|
||||||
integrationSettings.remove( AvailableSettings.CFG_FILE );
|
// it does, so load those properties
|
||||||
// it does, so load those properties
|
JaxbHibernateConfiguration configurationElement = configLoaderHolder.getValue().loadConfigXmlResource(
|
||||||
JaxbHibernateConfiguration configurationElement = configLoaderHolder.getValue().loadConfigXmlResource(
|
cfgXmlResourceName2
|
||||||
cfgXmlResourceName
|
);
|
||||||
);
|
processHibernateConfigurationElement( configurationElement, merged );
|
||||||
processHibernateConfigurationElement( configurationElement, merged );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// finally, apply integration-supplied settings (per JPA spec, integration settings should override other sources)
|
// finally, apply integration-supplied settings (per JPA spec, integration settings should override other sources)
|
||||||
merged.putAll( integrationSettings );
|
merged.putAll( integrationSettings );
|
||||||
|
|
||||||
if ( ! merged.containsKey( AvailableSettings.VALIDATION_MODE ) ) {
|
if ( !merged.containsKey( AvailableSettings.VALIDATION_MODE ) ) {
|
||||||
if ( persistenceUnit.getValidationMode() != null ) {
|
if ( persistenceUnit.getValidationMode() != null ) {
|
||||||
merged.put( AvailableSettings.VALIDATION_MODE, persistenceUnit.getValidationMode() );
|
merged.put( AvailableSettings.VALIDATION_MODE, persistenceUnit.getValidationMode() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ! merged.containsKey( AvailableSettings.SHARED_CACHE_MODE ) ) {
|
if ( !merged.containsKey( AvailableSettings.SHARED_CACHE_MODE ) ) {
|
||||||
if ( persistenceUnit.getSharedCacheMode() != null ) {
|
if ( persistenceUnit.getSharedCacheMode() != null ) {
|
||||||
merged.put( AvailableSettings.SHARED_CACHE_MODE, persistenceUnit.getSharedCacheMode() );
|
merged.put( AvailableSettings.SHARED_CACHE_MODE, persistenceUnit.getSharedCacheMode() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,48 +43,50 @@ public class BinaryArithmeticOperation<N extends Number>
|
||||||
|
|
||||||
public static enum Operation {
|
public static enum Operation {
|
||||||
ADD {
|
ADD {
|
||||||
|
@Override
|
||||||
String apply(String lhs, String rhs) {
|
String apply(String lhs, String rhs) {
|
||||||
return applyPrimitive( lhs, '+', rhs );
|
return applyPrimitive( lhs, '+', rhs );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
SUBTRACT {
|
SUBTRACT {
|
||||||
|
@Override
|
||||||
String apply(String lhs, String rhs) {
|
String apply(String lhs, String rhs) {
|
||||||
return applyPrimitive( lhs, '-', rhs );
|
return applyPrimitive( lhs, '-', rhs );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
MULTIPLY {
|
MULTIPLY {
|
||||||
|
@Override
|
||||||
String apply(String lhs, String rhs) {
|
String apply(String lhs, String rhs) {
|
||||||
return applyPrimitive( lhs, '*', rhs );
|
return applyPrimitive( lhs, '*', rhs );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
DIVIDE {
|
DIVIDE {
|
||||||
|
@Override
|
||||||
String apply(String lhs, String rhs) {
|
String apply(String lhs, String rhs) {
|
||||||
return applyPrimitive( lhs, '/', rhs );
|
return applyPrimitive( lhs, '/', rhs );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
QUOT {
|
QUOT {
|
||||||
|
@Override
|
||||||
String apply(String lhs, String rhs) {
|
String apply(String lhs, String rhs) {
|
||||||
return applyPrimitive( lhs, '/', rhs );
|
return applyPrimitive( lhs, '/', rhs );
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
MOD {
|
MOD {
|
||||||
|
@Override
|
||||||
String apply(String lhs, String rhs) {
|
String apply(String lhs, String rhs) {
|
||||||
// return lhs + " % " + rhs;
|
// return lhs + " % " + rhs;
|
||||||
return "mod(" + lhs + "," + rhs + ")";
|
return "mod(" + lhs + "," + rhs + ")";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
abstract String apply(String lhs, String rhs);
|
abstract String apply(String lhs, String rhs);
|
||||||
|
|
||||||
private static final char LEFT_PAREN = '(';
|
private static final char LEFT_PAREN = '(';
|
||||||
private static final char RIGHT_PAREN = ')';
|
private static final char RIGHT_PAREN = ')';
|
||||||
|
|
||||||
private static String applyPrimitive(String lhs, char operator, String rhs) {
|
private static String applyPrimitive(String lhs, char operator, String rhs) {
|
||||||
return new StringBuffer( lhs.length() + rhs.length() + 3 )
|
return String.valueOf( LEFT_PAREN ) + lhs + operator + rhs + RIGHT_PAREN;
|
||||||
.append( LEFT_PAREN )
|
|
||||||
.append( lhs )
|
|
||||||
.append( operator )
|
|
||||||
.append( rhs )
|
|
||||||
.append( RIGHT_PAREN )
|
|
||||||
.toString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,8 +104,7 @@ public class BinaryArithmeticOperation<N extends Number>
|
||||||
public static Class<? extends Number> determineResultType(
|
public static Class<? extends Number> determineResultType(
|
||||||
Class<? extends Number> argument1Type,
|
Class<? extends Number> argument1Type,
|
||||||
Class<? extends Number> argument2Type,
|
Class<? extends Number> argument2Type,
|
||||||
boolean isQuotientOperation
|
boolean isQuotientOperation) {
|
||||||
) {
|
|
||||||
if ( isQuotientOperation ) {
|
if ( isQuotientOperation ) {
|
||||||
return Number.class;
|
return Number.class;
|
||||||
}
|
}
|
||||||
|
@ -206,28 +207,23 @@ public class BinaryArithmeticOperation<N extends Number>
|
||||||
return operator;
|
return operator;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Expression<? extends N> getRightHandOperand() {
|
public Expression<? extends N> getRightHandOperand() {
|
||||||
return rhs;
|
return rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Expression<? extends N> getLeftHandOperand() {
|
public Expression<? extends N> getLeftHandOperand() {
|
||||||
return lhs;
|
return lhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void registerParameters(ParameterRegistry registry) {
|
public void registerParameters(ParameterRegistry registry) {
|
||||||
Helper.possibleParameter( getRightHandOperand(), registry );
|
Helper.possibleParameter( getRightHandOperand(), registry );
|
||||||
Helper.possibleParameter( getLeftHandOperand(), registry );
|
Helper.possibleParameter( getLeftHandOperand(), registry );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String render(RenderingContext renderingContext) {
|
public String render(RenderingContext renderingContext) {
|
||||||
return getOperator().apply(
|
return getOperator().apply(
|
||||||
( (Renderable) getLeftHandOperand() ).render( renderingContext ),
|
( (Renderable) getLeftHandOperand() ).render( renderingContext ),
|
||||||
|
@ -235,6 +231,7 @@ public class BinaryArithmeticOperation<N extends Number>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String renderProjection(RenderingContext renderingContext) {
|
public String renderProjection(RenderingContext renderingContext) {
|
||||||
return render( renderingContext );
|
return render( renderingContext );
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,25 +61,23 @@ public class UnaryArithmeticOperation<T>
|
||||||
return operation;
|
return operation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Expression<T> getOperand() {
|
public Expression<T> getOperand() {
|
||||||
return operand;
|
return operand;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public void registerParameters(ParameterRegistry registry) {
|
public void registerParameters(ParameterRegistry registry) {
|
||||||
Helper.possibleParameter( getOperand(), registry );
|
Helper.possibleParameter( getOperand(), registry );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String render(RenderingContext renderingContext) {
|
public String render(RenderingContext renderingContext) {
|
||||||
return ( getOperation() == Operation.UNARY_MINUS ? '-' : '+' )
|
return ( getOperation() == Operation.UNARY_MINUS ? '-' : '+' )
|
||||||
+ ( (Renderable) getOperand() ).render( renderingContext );
|
+ ( (Renderable) getOperand() ).render( renderingContext );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String renderProjection(RenderingContext renderingContext) {
|
public String renderProjection(RenderingContext renderingContext) {
|
||||||
return render( renderingContext );
|
return render( renderingContext );
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,37 +60,27 @@ public abstract class AbstractAttribute<X, Y>
|
||||||
this.persistentAttributeType = persistentAttributeType;
|
this.persistentAttributeType = persistentAttributeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public ManagedType<X> getDeclaringType() {
|
public ManagedType<X> getDeclaringType() {
|
||||||
return declaringType;
|
return declaringType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Class<Y> getJavaType() {
|
public Class<Y> getJavaType() {
|
||||||
return javaType;
|
return javaType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Member getJavaMember() {
|
public Member getJavaMember() {
|
||||||
return member;
|
return member;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public PersistentAttributeType getPersistentAttributeType() {
|
public PersistentAttributeType getPersistentAttributeType() {
|
||||||
return persistentAttributeType;
|
return persistentAttributeType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,37 +154,27 @@ public abstract class PluralAttributeImpl<X, C, E>
|
||||||
return new Builder<X,C,E,K>(ownerType, attrType, collectionClass, keyType);
|
return new Builder<X,C,E,K>(ownerType, attrType, collectionClass, keyType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Type<E> getElementType() {
|
public Type<E> getElementType() {
|
||||||
return elementType;
|
return elementType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isAssociation() {
|
public boolean isAssociation() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isCollection() {
|
public boolean isCollection() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public BindableType getBindableType() {
|
public BindableType getBindableType() {
|
||||||
return BindableType.PLURAL_ATTRIBUTE;
|
return BindableType.PLURAL_ATTRIBUTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Class<E> getBindableJavaType() {
|
public Class<E> getBindableJavaType() {
|
||||||
return elementType.getJavaType();
|
return elementType.getJavaType();
|
||||||
}
|
}
|
||||||
|
@ -194,9 +184,7 @@ public abstract class PluralAttributeImpl<X, C, E>
|
||||||
super( xceBuilder );
|
super( xceBuilder );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public CollectionType getCollectionType() {
|
public CollectionType getCollectionType() {
|
||||||
return CollectionType.SET;
|
return CollectionType.SET;
|
||||||
}
|
}
|
||||||
|
@ -207,9 +195,7 @@ public abstract class PluralAttributeImpl<X, C, E>
|
||||||
super( xceBuilder );
|
super( xceBuilder );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public CollectionType getCollectionType() {
|
public CollectionType getCollectionType() {
|
||||||
return CollectionType.COLLECTION;
|
return CollectionType.COLLECTION;
|
||||||
}
|
}
|
||||||
|
@ -220,9 +206,7 @@ public abstract class PluralAttributeImpl<X, C, E>
|
||||||
super( xceBuilder );
|
super( xceBuilder );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public CollectionType getCollectionType() {
|
public CollectionType getCollectionType() {
|
||||||
return CollectionType.LIST;
|
return CollectionType.LIST;
|
||||||
}
|
}
|
||||||
|
@ -236,23 +220,17 @@ public abstract class PluralAttributeImpl<X, C, E>
|
||||||
this.keyType = xceBuilder.keyType;
|
this.keyType = xceBuilder.keyType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public CollectionType getCollectionType() {
|
public CollectionType getCollectionType() {
|
||||||
return CollectionType.MAP;
|
return CollectionType.MAP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Class<K> getKeyJavaType() {
|
public Class<K> getKeyJavaType() {
|
||||||
return keyType.getJavaType();
|
return keyType.getJavaType();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Type<K> getKeyType() {
|
public Type<K> getKeyType() {
|
||||||
return keyType;
|
return keyType;
|
||||||
}
|
}
|
||||||
|
|
|
@ -775,20 +775,14 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage
|
||||||
|
|
||||||
final SessionFactoryImplementor sfi = entityManagerFactory.getSessionFactory();
|
final SessionFactoryImplementor sfi = entityManagerFactory.getSessionFactory();
|
||||||
|
|
||||||
// first try as hql/jpql query
|
final NamedQueryDefinition jpqlDefinition = sfi.getNamedQueryRepository().getNamedQueryDefinition( name );
|
||||||
{
|
if ( jpqlDefinition != null ) {
|
||||||
final NamedQueryDefinition namedQueryDefinition = sfi.getNamedQueryRepository().getNamedQueryDefinition( name );
|
return createNamedJpqlQuery( jpqlDefinition, resultType );
|
||||||
if ( namedQueryDefinition != null ) {
|
|
||||||
return createNamedJpqlQuery( namedQueryDefinition, resultType );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// then as a native (SQL) query
|
final NamedSQLQueryDefinition nativeQueryDefinition = sfi.getNamedQueryRepository().getNamedSQLQueryDefinition( name );
|
||||||
{
|
if ( nativeQueryDefinition != null ) {
|
||||||
final NamedSQLQueryDefinition namedQueryDefinition = sfi.getNamedQueryRepository().getNamedSQLQueryDefinition( name );
|
return createNamedSqlQuery( nativeQueryDefinition, resultType );
|
||||||
if ( namedQueryDefinition != null ) {
|
|
||||||
return createNamedSqlQuery( namedQueryDefinition, resultType );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw convert( new IllegalArgumentException( "No query defined for that name [" + name + "]" ) );
|
throw convert( new IllegalArgumentException( "No query defined for that name [" + name + "]" ) );
|
||||||
|
@ -1247,9 +1241,9 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage
|
||||||
public void refresh(Object entity, LockModeType lockModeType, Map<String, Object> properties) {
|
public void refresh(Object entity, LockModeType lockModeType, Map<String, Object> properties) {
|
||||||
checkOpen();
|
checkOpen();
|
||||||
|
|
||||||
Session session = internalGetSession();
|
final Session session = internalGetSession();
|
||||||
CacheMode previousCacheMode = session.getCacheMode();
|
final CacheMode previousCacheMode = session.getCacheMode();
|
||||||
CacheMode localCacheMode = determineAppropriateLocalCacheMode( properties );
|
final CacheMode localCacheMode = determineAppropriateLocalCacheMode( properties );
|
||||||
LockOptions lockOptions = null;
|
LockOptions lockOptions = null;
|
||||||
try {
|
try {
|
||||||
session.setCacheMode( localCacheMode );
|
session.setCacheMode( localCacheMode );
|
||||||
|
@ -1737,10 +1731,10 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage
|
||||||
handlePersistenceException( converted );
|
handlePersistenceException( converted );
|
||||||
return converted;
|
return converted;
|
||||||
}
|
}
|
||||||
else if ( e instanceof org.hibernate.NonUniqueObjectException ) {
|
else if ( e instanceof org.hibernate.NonUniqueObjectException ) {
|
||||||
final EntityExistsException converted = new EntityExistsException( e.getMessage() );
|
final EntityExistsException converted = new EntityExistsException( e.getMessage() );
|
||||||
handlePersistenceException( converted );
|
handlePersistenceException( converted );
|
||||||
return converted;
|
return converted;
|
||||||
}
|
}
|
||||||
else if ( e instanceof org.hibernate.NonUniqueResultException ) {
|
else if ( e instanceof org.hibernate.NonUniqueResultException ) {
|
||||||
final NonUniqueResultException converted = new NonUniqueResultException( e.getMessage() );
|
final NonUniqueResultException converted = new NonUniqueResultException( e.getMessage() );
|
||||||
|
@ -1761,7 +1755,7 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage
|
||||||
}
|
}
|
||||||
catch ( Exception ne ) {
|
catch ( Exception ne ) {
|
||||||
//we do not want the subsequent exception to swallow the original one
|
//we do not want the subsequent exception to swallow the original one
|
||||||
LOG.unableToMarkForRollbackOnTransientObjectException(ne);
|
LOG.unableToMarkForRollbackOnTransientObjectException( ne );
|
||||||
}
|
}
|
||||||
return new IllegalStateException( e ); //Spec 3.2.3 Synchronization rules
|
return new IllegalStateException( e ); //Spec 3.2.3 Synchronization rules
|
||||||
}
|
}
|
||||||
|
@ -1781,7 +1775,7 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage
|
||||||
public PersistenceException wrapStaleStateException(StaleStateException e) {
|
public PersistenceException wrapStaleStateException(StaleStateException e) {
|
||||||
PersistenceException pe;
|
PersistenceException pe;
|
||||||
if ( e instanceof StaleObjectStateException ) {
|
if ( e instanceof StaleObjectStateException ) {
|
||||||
final StaleObjectStateException sose = ( StaleObjectStateException ) e;
|
final StaleObjectStateException sose = (StaleObjectStateException) e;
|
||||||
final Serializable identifier = sose.getIdentifier();
|
final Serializable identifier = sose.getIdentifier();
|
||||||
if ( identifier != null ) {
|
if ( identifier != null ) {
|
||||||
try {
|
try {
|
||||||
|
@ -1828,7 +1822,7 @@ public abstract class AbstractEntityManagerImpl implements HibernateEntityManage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( e instanceof org.hibernate.PessimisticLockException ) {
|
else if ( e instanceof org.hibernate.PessimisticLockException ) {
|
||||||
final org.hibernate.PessimisticLockException jdbcLockException = ( org.hibernate.PessimisticLockException ) e;
|
final org.hibernate.PessimisticLockException jdbcLockException = (org.hibernate.PessimisticLockException) e;
|
||||||
if ( lockOptions != null && lockOptions.getTimeOut() > -1 ) {
|
if ( lockOptions != null && lockOptions.getTimeOut() > -1 ) {
|
||||||
// assume lock timeout occurred if a timeout or NO WAIT was specified
|
// assume lock timeout occurred if a timeout or NO WAIT was specified
|
||||||
pe = new LockTimeoutException( jdbcLockException.getMessage(), jdbcLockException, null );
|
pe = new LockTimeoutException( jdbcLockException.getMessage(), jdbcLockException, null );
|
||||||
|
|
|
@ -87,6 +87,7 @@ abstract class AbstractReadWriteAccessStrategy extends BaseRegionAccessStrategy
|
||||||
/**
|
/**
|
||||||
* Soft-lock a cache item.
|
* Soft-lock a cache item.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final SoftLock lockItem(Object key, Object version) throws CacheException {
|
public final SoftLock lockItem(Object key, Object version) throws CacheException {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -110,6 +111,7 @@ abstract class AbstractReadWriteAccessStrategy extends BaseRegionAccessStrategy
|
||||||
/**
|
/**
|
||||||
* Soft-unlock a cache item.
|
* Soft-unlock a cache item.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void unlockItem(Object key, SoftLock lock) throws CacheException {
|
public final void unlockItem(Object key, SoftLock lock) throws CacheException {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -205,37 +207,27 @@ abstract class AbstractReadWriteAccessStrategy extends BaseRegionAccessStrategy
|
||||||
this.timestamp = timestamp;
|
this.timestamp = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isReadable(long txTimestamp) {
|
public boolean isReadable(long txTimestamp) {
|
||||||
return txTimestamp > timestamp;
|
return txTimestamp > timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isWriteable(long txTimestamp, Object newVersion, Comparator versionComparator) {
|
public boolean isWriteable(long txTimestamp, Object newVersion, Comparator versionComparator) {
|
||||||
return version != null && versionComparator.compare( version, newVersion ) < 0;
|
return version != null && versionComparator.compare( version, newVersion ) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object getValue() {
|
public Object getValue() {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isUnlockable(SoftLock lock) {
|
public boolean isUnlockable(SoftLock lock) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Lock lock(long timeout, UUID uuid, long lockId) {
|
public Lock lock(long timeout, UUID uuid, long lockId) {
|
||||||
return new Lock( timeout, uuid, lockId, version );
|
return new Lock( timeout, uuid, lockId, version );
|
||||||
}
|
}
|
||||||
|
@ -267,16 +259,12 @@ abstract class AbstractReadWriteAccessStrategy extends BaseRegionAccessStrategy
|
||||||
this.sourceUuid = sourceUuid;
|
this.sourceUuid = sourceUuid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isReadable(long txTimestamp) {
|
public boolean isReadable(long txTimestamp) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isWriteable(long txTimestamp, Object newVersion, Comparator versionComparator) {
|
public boolean isWriteable(long txTimestamp, Object newVersion, Comparator versionComparator) {
|
||||||
if ( txTimestamp > timeout ) {
|
if ( txTimestamp > timeout ) {
|
||||||
// if timedout then allow write
|
// if timedout then allow write
|
||||||
|
@ -292,23 +280,16 @@ abstract class AbstractReadWriteAccessStrategy extends BaseRegionAccessStrategy
|
||||||
) < 0;
|
) < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Object getValue() {
|
public Object getValue() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean isUnlockable(SoftLock lock) {
|
public boolean isUnlockable(SoftLock lock) {
|
||||||
return equals( lock );
|
return equals( lock );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
if ( o == this ) {
|
if ( o == this ) {
|
||||||
|
@ -322,9 +303,6 @@ abstract class AbstractReadWriteAccessStrategy extends BaseRegionAccessStrategy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = ( sourceUuid != null ? sourceUuid.hashCode() : 0 );
|
int hash = ( sourceUuid != null ? sourceUuid.hashCode() : 0 );
|
||||||
|
@ -342,9 +320,7 @@ abstract class AbstractReadWriteAccessStrategy extends BaseRegionAccessStrategy
|
||||||
return concurrent;
|
return concurrent;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public Lock lock(long timeout, UUID uuid, long lockId) {
|
public Lock lock(long timeout, UUID uuid, long lockId) {
|
||||||
concurrent = true;
|
concurrent = true;
|
||||||
multiplicity++;
|
multiplicity++;
|
||||||
|
@ -361,9 +337,7 @@ abstract class AbstractReadWriteAccessStrategy extends BaseRegionAccessStrategy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder sb = new StringBuilder( "Lock Source-UUID:" + sourceUuid + " Lock-ID:" + lockId );
|
StringBuilder sb = new StringBuilder( "Lock Source-UUID:" + sourceUuid + " Lock-ID:" + lockId );
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
|
|
|
@ -11,33 +11,22 @@ class TransactionalEntityRegionAccessStrategy extends BaseEntityRegionAccessStra
|
||||||
super( region );
|
super( region );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean afterInsert(Object key, Object value, Object version) {
|
public boolean afterInsert(Object key, Object value, Object version) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) {
|
public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public void remove(Object key) throws CacheException {
|
public void remove(Object key) throws CacheException {
|
||||||
evict( key );
|
evict( key );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
/**
|
|
||||||
* {@inheritDoc}
|
|
||||||
*/
|
|
||||||
public boolean update(Object key, Object value, Object currentVersion,
|
public boolean update(Object key, Object value, Object currentVersion,
|
||||||
Object previousVersion) throws CacheException {
|
Object previousVersion) throws CacheException {
|
||||||
return insert( key, value, currentVersion );
|
return insert( key, value, currentVersion );
|
||||||
|
|
Loading…
Reference in New Issue