org.hibernate.hql.internal.ast.HqlSqlWalker Java Examples

The following examples show how to use org.hibernate.hql.internal.ast.HqlSqlWalker. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityGraphQueryHint.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public List<FromElement> toFromElements(FromClause fromClause, HqlSqlWalker walker) {
	// If a role already has an explicit fetch in the query, skip it in the graph.
	Map<String, FromElement> explicitFetches = new HashMap<String, FromElement>();
	for ( Object o : fromClause.getFromElements() ) {
		final FromElement fromElement = (FromElement) o;
		if ( fromElement.getRole() != null  && ! (fromElement instanceof ImpliedFromElement) ) {
			explicitFetches.put( fromElement.getRole(), fromElement );
		}
	}

	return getFromElements(
			fromClause.getLevel() == FromClause.ROOT_LEVEL ? originEntityGraph.getAttributeNodes():
				Collections.emptyList(),
			fromClause.getFromElement(),
			fromClause,
			walker,
			explicitFetches
	);
}
 
Example #2
Source File: InlineIdsSubSelectValuesListDeleteHandlerImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public InlineIdsSubSelectValuesListDeleteHandlerImpl(
		SessionFactoryImplementor factory,
		HqlSqlWalker walker) {
	super( factory, walker );

	Dialect dialect = factory().getServiceRegistry().getService( JdbcServices.class ).getDialect();
	if ( !dialect.supportsRowValueConstructorSyntaxInInList() ) {
		throw new UnsupportedOperationException(
				"The " + getClass().getSimpleName() +
						" can only be used with Dialects that support IN clause row-value expressions (for composite identifiers)!"
		);
	}
	if ( !dialect.supportsValuesList() ) {
		throw new UnsupportedOperationException(
				"The " + getClass().getSimpleName() +
						" can only be used with Dialects that support VALUES lists!"
		);
	}
}
 
Example #3
Source File: InlineIdsSubSelectValuesListUpdateHandlerImpl.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public InlineIdsSubSelectValuesListUpdateHandlerImpl(
		SessionFactoryImplementor factory,
		HqlSqlWalker walker) {
	super( factory, walker );

	Dialect dialect = factory().getServiceRegistry().getService( JdbcServices.class ).getDialect();
	if ( !dialect.supportsRowValueConstructorSyntaxInInList() ) {
		throw new UnsupportedOperationException(
				"The " + getClass().getSimpleName() +
						" can only be used with Dialects that support IN clause row-value expressions (for composite identifiers)!"
		);
	}
	if ( !dialect.supportsValuesList() ) {
		throw new UnsupportedOperationException(
				"The " + getClass().getSimpleName() +
						" can only be used with Dialects that support VALUES lists!"
		);
	}
}
 
Example #4
Source File: GlobalTemporaryTableBulkIdStrategy.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
public DeleteHandler buildDeleteHandler(SessionFactoryImplementor factory, HqlSqlWalker walker) {
	final DeleteStatement updateStatement = (DeleteStatement) walker.getAST();

	final FromElement fromElement = updateStatement.getFromClause().getFromElement();
	final Queryable targetedPersister = fromElement.getQueryable();

	return new TableBasedDeleteHandlerImpl( factory, walker, getIdTableInfo( targetedPersister ) ) {
		@Override
		protected void releaseFromUse(Queryable persister, SharedSessionContractImplementor session) {
			if ( afterUseAction == AfterUseAction.NONE ) {
				return;
			}

			// clean up our id-table rows
			cleanUpRows( getIdTableInfo( persister ).getQualifiedIdTableName(), session );
		}
	};
}
 
Example #5
Source File: GlobalTemporaryTableBulkIdStrategy.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
@Override
public UpdateHandler buildUpdateHandler(SessionFactoryImplementor factory, HqlSqlWalker walker) {
	final UpdateStatement updateStatement = (UpdateStatement) walker.getAST();

	final FromElement fromElement = updateStatement.getFromClause().getFromElement();
	final Queryable targetedPersister = fromElement.getQueryable();

	return new TableBasedUpdateHandlerImpl( factory, walker, getIdTableInfo( targetedPersister ) ) {
		@Override
		protected void releaseFromUse(Queryable persister, SharedSessionContractImplementor session) {
			if ( afterUseAction == AfterUseAction.NONE ) {
				return;
			}

			// clean up our id-table rows
			cleanUpRows( getIdTableInfo( persister ).getQualifiedIdTableName(), session );
		}
	};
}
 
Example #6
Source File: PersistentTableBulkIdStrategy.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public UpdateHandler buildUpdateHandler(SessionFactoryImplementor factory, HqlSqlWalker walker) {
	final UpdateStatement updateStatement = (UpdateStatement) walker.getAST();

	final FromElement fromElement = updateStatement.getFromClause().getFromElement();
	final Queryable targetedPersister = fromElement.getQueryable();

	return new UpdateHandlerImpl(
			factory,
			walker,
			getIdTableInfo( targetedPersister )
	);
}
 
Example #7
Source File: PersistentTableBulkIdStrategy.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public DeleteHandler buildDeleteHandler(SessionFactoryImplementor factory, HqlSqlWalker walker) {
	final DeleteStatement updateStatement = (DeleteStatement) walker.getAST();

	final FromElement fromElement = updateStatement.getFromClause().getFromElement();
	final Queryable targetedPersister = fromElement.getQueryable();

	return new DeleteHandlerImpl(
			factory,
			walker,
			getIdTableInfo( targetedPersister )
	);
}
 
Example #8
Source File: UpdateHandlerImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public UpdateHandlerImpl(
		SessionFactoryImplementor factory,
		HqlSqlWalker walker,
		IdTableInfo idTableInfo) {
	super( factory, walker, idTableInfo );
	this.idTableInfo = idTableInfo;
}
 
Example #9
Source File: DeleteHandlerImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public DeleteHandlerImpl(
		SessionFactoryImplementor factory,
		HqlSqlWalker walker,
		IdTableInfo idTableInfo) {
	super( factory, walker, idTableInfo );
	this.idTableInfo = idTableInfo;
}
 
Example #10
Source File: InlineIdsSubSelectValueListBulkIdStrategy.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public DeleteHandler buildDeleteHandler(
		SessionFactoryImplementor factory,
		HqlSqlWalker walker) {
	return new InlineIdsSubSelectValuesListDeleteHandlerImpl(
			factory,
			walker
	);
}
 
Example #11
Source File: InlineIdsSubSelectValueListBulkIdStrategy.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
public UpdateHandler buildUpdateHandler(
		SessionFactoryImplementor factory,
		HqlSqlWalker walker) {
	return new InlineIdsSubSelectValuesListUpdateHandlerImpl(
			factory,
			walker
	);
}
 
Example #12
Source File: InlineIdsIdsInClauseDeleteHandlerImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public InlineIdsIdsInClauseDeleteHandlerImpl(
		SessionFactoryImplementor factory,
		HqlSqlWalker walker) {
	super( factory, walker );
	Dialect dialect = factory.getServiceRegistry().getService( JdbcServices.class ).getDialect();
	if ( !dialect.supportsRowValueConstructorSyntaxInInList() ) {
		throw new UnsupportedOperationException(
				"The " + getClass().getSimpleName() +
						" can only be used with Dialects that support IN clause row-value expressions (for composite identifiers)!"
		);
	}
}
 
Example #13
Source File: InlineIdsInClauseUpdateHandlerImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public InlineIdsInClauseUpdateHandlerImpl(
		SessionFactoryImplementor factory,
		HqlSqlWalker walker) {
	super( factory, walker );
	Dialect dialect = factory.getServiceRegistry().getService( JdbcServices.class ).getDialect();
	if ( !dialect.supportsRowValueConstructorSyntaxInInList() ) {
		throw new UnsupportedOperationException(
				"The " + getClass().getSimpleName() +
						" can only be used with Dialects that support IN clause row-value expressions (for composite identifiers)!"
		);
	}
}
 
Example #14
Source File: BasicExecutor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public BasicExecutor(HqlSqlWalker walker, Queryable persister) {
	this.persister = persister;
	try {
		SqlGenerator gen = new SqlGenerator( walker.getSessionFactoryHelper().getFactory() );
		gen.statement( walker.getAST() );
		sql = gen.getSQL();
		gen.getParseErrorHandler().throwQueryException();
		parameterSpecifications = gen.getCollectedParameters();
	}
	catch ( RecognitionException e ) {
		throw QuerySyntaxException.convert( e );
	}
}
 
Example #15
Source File: MultiTableUpdateExecutor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public MultiTableUpdateExecutor(HqlSqlWalker walker) {
	MultiTableBulkIdStrategy strategy = walker.getSessionFactoryHelper()
			.getFactory()
			.getSessionFactoryOptions()
			.getMultiTableBulkIdStrategy();
	this.updateHandler = strategy.buildUpdateHandler( walker.getSessionFactoryHelper().getFactory(), walker );
}
 
Example #16
Source File: JoinProcessor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private static boolean hasDynamicFilterParam(HqlSqlWalker walker, String sqlFragment) {
	String closeQuote = String.valueOf( walker.getDialect().closeQuote()  );

	Matcher matcher = DYNAMIC_FILTER_PATTERN.matcher( sqlFragment );
	if ( matcher.find() && matcher.groupCount() > 0 ) {
		String match = matcher.group( 1 );
		return match.endsWith( closeQuote ) || match.endsWith( LITERAL_DELIMITER );
	}
	return true;
}
 
Example #17
Source File: AbstractCteValuesListBulkIdHandler.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public AbstractCteValuesListBulkIdHandler(
		SessionFactoryImplementor sessionFactory, HqlSqlWalker walker,
		String catalog, String schema) {
	super( sessionFactory, walker );
	Dialect dialect = sessionFactory.getServiceRegistry().getService( JdbcServices.class ).getDialect();
	if ( !dialect.supportsNonQueryWithCTE() ) {
		throw new UnsupportedOperationException(
				"The " + getClass().getSimpleName() +
						" can only be used with Dialects that support CTE that can take UPDATE or DELETE statements as well!"
		);
	}
	if ( !dialect.supportsValuesList() ) {
		throw new UnsupportedOperationException(
				"The " + getClass().getSimpleName() +
						" can only be used with Dialects that support VALUES lists!"
		);
	}
	if ( !dialect.supportsRowValueConstructorSyntaxInInList() ) {
		throw new UnsupportedOperationException(
				"The " + getClass().getSimpleName() +
						" can only be used with Dialects that support IN clause row-value expressions (for composite identifiers)!"
		);
	}

	this.jdbcEnvironment = sessionFactory.getServiceRegistry().getService(
			JdbcServices.class ).getJdbcEnvironment();
	this.catalog = catalog;
	this.schema = schema;
}
 
Example #18
Source File: CteValuesListDeleteHandlerImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public CteValuesListDeleteHandlerImpl(
		SessionFactoryImplementor factory,
		HqlSqlWalker walker,
		String catalog,
		String schema) {
	super( factory, walker, catalog, schema );

	final String idSubselect = generateIdSubselect( getTargetedQueryable() );

	for ( Type type : getTargetedQueryable().getPropertyTypes() ) {
		if ( type.isCollectionType() ) {
			CollectionType cType = (CollectionType) type;
			AbstractCollectionPersister cPersister = (AbstractCollectionPersister) factory.getMetamodel().collectionPersister( cType.getRole() );
			if ( cPersister.isManyToMany() ) {
				deletes.add( generateDelete(
						cPersister.getTableName(),
						cPersister.getKeyColumnNames(),
						idSubselect,
						"bulk delete - m2m join table cleanup"
				) );
			}
		}
	}

	String[] tableNames = getTargetedQueryable().getConstraintOrderedTableNameClosure();
	String[][] columnNames = getTargetedQueryable().getContraintOrderedTableKeyColumnClosure();
	for ( int i = 0; i < tableNames.length; i++ ) {
		// TODO : an optimization here would be to consider cascade deletes and not gen those delete statements;
		//      the difficulty is the ordering of the tables here vs the cascade attributes on the persisters ->
		//          the table info gotten here should really be self-contained (i.e., a class representation
		//          defining all the needed attributes), then we could then get an array of those
		deletes.add( generateDelete( tableNames[i], columnNames[i], idSubselect, "bulk delete" ) );
	}
}
 
Example #19
Source File: CteValuesListUpdateHandlerImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
public CteValuesListUpdateHandlerImpl(
		SessionFactoryImplementor factory,
		HqlSqlWalker walker,
		String catalog,
		String schema) {
	super( factory, walker, catalog, schema );

	String[] tableNames = getTargetedQueryable().getConstraintOrderedTableNameClosure();
	String[][] columnNames = getTargetedQueryable().getContraintOrderedTableKeyColumnClosure();
	String idSubselect = generateIdSubselect( getTargetedQueryable() );

	updates = new String[tableNames.length];
	assignmentParameterSpecifications = new ParameterSpecification[tableNames.length][];
	for ( int tableIndex = 0; tableIndex < tableNames.length; tableIndex++ ) {
		boolean affected = false;
		final List<ParameterSpecification> parameterList = new ArrayList<>();
		final Update update = new Update( factory.getServiceRegistry().getService( JdbcServices.class ).getDialect() )
				.setTableName( tableNames[tableIndex] )
				.setWhere( "(" + String.join( ", ", (CharSequence[]) columnNames[tableIndex] ) + ") in (" + idSubselect + ")" );
		if ( factory().getSessionFactoryOptions().isCommentsEnabled() ) {
			update.setComment( "bulk update" );
		}
		final List<AssignmentSpecification> assignmentSpecifications = walker.getAssignmentSpecifications();
		for ( AssignmentSpecification assignmentSpecification : assignmentSpecifications ) {
			if ( assignmentSpecification.affectsTable( tableNames[tableIndex] ) ) {
				affected = true;
				update.appendAssignmentFragment( assignmentSpecification.getSqlAssignmentFragment() );
				if ( assignmentSpecification.getParameters() != null ) {
					Collections.addAll( parameterList, assignmentSpecification.getParameters() );
				}
			}
		}
		if ( affected ) {
			updates[tableIndex] = update.toStatementString();
			assignmentParameterSpecifications[tableIndex] = parameterList.toArray( new ParameterSpecification[parameterList.size()] );
		}
	}
}
 
Example #20
Source File: InlineIdsIdsOrClauseDeleteHandlerImpl.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public InlineIdsIdsOrClauseDeleteHandlerImpl(
		SessionFactoryImplementor factory,
		HqlSqlWalker walker) {
	super( factory, walker );
}
 
Example #21
Source File: InlineIdsOrClauseUpdateHandlerImpl2.java    From zstack with Apache License 2.0 4 votes vote down vote up
public InlineIdsOrClauseUpdateHandlerImpl2(SessionFactoryImplementor factory, HqlSqlWalker walker) {
    super(factory, walker);
}
 
Example #22
Source File: InlineIdsOrClauseBulkIdStrategy2.java    From zstack with Apache License 2.0 4 votes vote down vote up
@Override
public UpdateHandler buildUpdateHandler(
        SessionFactoryImplementor factory,
        HqlSqlWalker walker) {
    return new InlineIdsOrClauseUpdateHandlerImpl2( factory, walker );
}
 
Example #23
Source File: InlineIdsOrClauseBulkIdStrategy2.java    From zstack with Apache License 2.0 4 votes vote down vote up
@Override
public DeleteHandler buildDeleteHandler(
        SessionFactoryImplementor factory,
        HqlSqlWalker walker) {
    return new InlineIdsIdsOrClauseDeleteHandlerImpl2( factory, walker );
}
 
Example #24
Source File: AbstractIdsBulkIdHandler.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public AbstractIdsBulkIdHandler(
		SessionFactoryImplementor sessionFactory, HqlSqlWalker walker) {
	super(sessionFactory, walker);

	final AbstractRestrictableStatement statement = (AbstractRestrictableStatement) walker.getAST();
	final FromElement fromElement = statement.getFromClause().getFromElement();

	this.targetedPersister = fromElement.getQueryable();

	final ProcessedWhereClause processedWhereClause = processWhereClause( statement.getWhereClause() );
	this.idSelectParameterSpecifications = processedWhereClause.getIdSelectParameterSpecifications();

	final String bulkTargetAlias = fromElement.getTableAlias();

	this.idSelect = generateIdSelect( bulkTargetAlias, processedWhereClause ).toStatementString();
}
 
Example #25
Source File: HqlSqlWalkerNode.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public void initialize(Object param) {
	walker = (HqlSqlWalker) param;
}
 
Example #26
Source File: HqlSqlWalkerNode.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public HqlSqlWalker getWalker() {
	return walker;
}
 
Example #27
Source File: InlineIdsIdsOrClauseDeleteHandlerImpl2.java    From zstack with Apache License 2.0 4 votes vote down vote up
public InlineIdsIdsOrClauseDeleteHandlerImpl2(SessionFactoryImplementor factory, HqlSqlWalker walker) {
    super(factory, walker);
}
 
Example #28
Source File: MapKeyEntityFromElement.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public static MapKeyEntityFromElement buildKeyJoin(FromElement collectionFromElement) {
		final HqlSqlWalker walker = collectionFromElement.getWalker();
		final SessionFactoryHelper sfh = walker.getSessionFactoryHelper();
		final SessionFactoryImplementor sf = sfh.getFactory();

		final QueryableCollection collectionPersister = collectionFromElement.getQueryableCollection();
		final Type indexType = collectionPersister.getIndexType();
		if ( indexType == null ) {
			throw new IllegalArgumentException( "Given collection is not indexed" );
		}
		if ( !indexType.isEntityType() ) {
			throw new IllegalArgumentException( "Given collection does not have an entity index" );
		}

		final EntityType indexEntityType = (EntityType) indexType;
		final EntityPersister indexEntityPersister = (EntityPersister) indexEntityType.getAssociatedJoinable( sf );

		final String rhsAlias = walker.getAliasGenerator().createName( indexEntityPersister.getEntityName() );
		final boolean useThetaJoin = collectionFromElement.getJoinSequence().isThetaStyle();

		MapKeyEntityFromElement join = new MapKeyEntityFromElement( useThetaJoin );
		join.initialize( HqlSqlTokenTypes.JOIN_FRAGMENT, ( (Joinable) indexEntityPersister ).getTableName() );
		join.initialize( collectionFromElement.getWalker() );

		join.initializeEntity(
				collectionFromElement.getFromClause(),
				indexEntityPersister.getEntityName(),
				indexEntityPersister,
				indexEntityType,
				"<map-key-join-" + collectionFromElement.getClassAlias() + ">",
				rhsAlias
		);

//		String[] joinColumns = determineJoinColuns( collectionPersister, joinTableAlias );
		// todo : assumes columns, no formulas
		String[] joinColumns = collectionPersister.getIndexColumnNames( collectionFromElement.getCollectionTableAlias() );

		JoinSequence joinSequence = sfh.createJoinSequence(
				useThetaJoin,
				indexEntityType,
				rhsAlias,
				// todo : ever a time when INNER is appropriate?
				//JoinType.LEFT_OUTER_JOIN,
				// needs to be an inner join because of how JoinSequence/JoinFragment work - ugh
//				JoinType.INNER_JOIN,
				collectionFromElement.getJoinSequence().getFirstJoin().getJoinType(),
				joinColumns
		);
		join.setJoinSequence( joinSequence );

		join.setOrigin( collectionFromElement, true );
		join.setColumns( joinColumns );

		join.setUseFromFragment( collectionFromElement.useFromFragment() );
		join.setUseWhereFragment( collectionFromElement.useWhereFragment() );

		walker.addQuerySpaces( indexEntityPersister.getQuerySpaces() );

		return join;
	}
 
Example #29
Source File: EntityJoinFromElement.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public EntityJoinFromElement(
			HqlSqlWalker walker,
			FromClause fromClause,
			EntityPersister entityPersister,
			JoinType joinType,
			boolean fetchProperties,
			String alias) {
		initialize( walker );

		final String tableName = ( (Joinable) entityPersister ).getTableName();
		final String tableAlias = fromClause.getAliasGenerator().createName( entityPersister.getEntityName() );

		final EntityType entityType = (EntityType) ( (Queryable) entityPersister ).getType();

		initializeEntity(
				fromClause,
				entityPersister.getEntityName(),
				entityPersister,
				entityType,
				alias,
				tableAlias
		);

		EntityJoinJoinSequenceImpl joinSequence = new EntityJoinJoinSequenceImpl(
				getSessionFactoryHelper().getFactory(),
				entityType,
				tableName,
				tableAlias,
				joinType

		);
		setJoinSequence( joinSequence );

		setAllPropertyFetch( fetchProperties );

		// Add to the query spaces.
		fromClause.getWalker().addQuerySpaces( entityPersister.getQuerySpaces() );

		setType( HqlSqlTokenTypes.ENTITY_JOIN );
//		setType( HqlSqlTokenTypes.FROM_FRAGMENT );
		setText( tableName );
	}
 
Example #30
Source File: DeleteExecutor.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public DeleteExecutor(HqlSqlWalker walker, Queryable persister) {
	super( walker, persister );
	
	final SessionFactoryImplementor factory = walker.getSessionFactoryHelper().getFactory();
	final Dialect dialect = factory.getJdbcServices().getJdbcEnvironment().getDialect();
	
	try {
		final DeleteStatement deleteStatement = (DeleteStatement) walker.getAST();
		
		final String idSubselectWhere;
		if ( deleteStatement.hasWhereClause() ) {
			final AST whereClause = deleteStatement.getWhereClause();
			final SqlGenerator gen = new SqlGenerator( factory );
			gen.whereClause( whereClause );
			parameterSpecifications = gen.getCollectedParameters();
			idSubselectWhere = gen.getSQL().length() > 7 ? gen.getSQL() : "";
		}
		else {
			parameterSpecifications = new ArrayList<>();
			idSubselectWhere = "";
		}
		
		// If many-to-many, delete the FK row in the collection table.
		for ( Type type : persister.getPropertyTypes() ) {
			if ( type.isCollectionType() ) {
				final CollectionType cType = (CollectionType) type;
				final AbstractCollectionPersister cPersister = (AbstractCollectionPersister) factory.getMetamodel().collectionPersister( cType.getRole() );
				if ( cPersister.isManyToMany() ) {
					if ( persister.getIdentifierColumnNames().length > 1
							&& !dialect.supportsTuplesInSubqueries() ) {
						LOG.warn(
								"This dialect is unable to cascade the delete into the many-to-many join table" +
								" when the entity has multiple primary keys.  Either properly setup cascading on" +
								" the constraints or manually clear the associations prior to deleting the entities."
						);
					}
					else {
						final String idSubselect = "(select "
								+ String.join( ", ", persister.getIdentifierColumnNames() ) + " from "
								+ persister.getTableName() + idSubselectWhere + ")";
						final String where = "(" + String.join( ", ", cPersister.getKeyColumnNames() )
								+ ") in " + idSubselect;
						final Delete delete = new Delete().setTableName( cPersister.getTableName() ).setWhere( where );
						if ( factory.getSessionFactoryOptions().isCommentsEnabled() ) {
							delete.setComment( "delete FKs in join table" );
						}
						deletes.add( delete.toStatementString() );
					}
				}
			}
		}
	}
	catch (RecognitionException e) {
		throw new HibernateException( "Unable to delete the FKs in the join table!", e );
	}
}