Java Code Examples for org.hibernate.type.AssociationType#getOnCondition()

The following examples show how to use org.hibernate.type.AssociationType#getOnCondition() . 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: OuterJoinableAssociation.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
public OuterJoinableAssociation(
		PropertyPath propertyPath,
		AssociationType joinableType,
		String lhsAlias,
		String[] lhsColumns,
		String rhsAlias,
		JoinType joinType,
		String withClause,
		boolean hasRestriction,
		SessionFactoryImplementor factory,
		Map enabledFilters) throws MappingException {
	this.propertyPath = propertyPath;
	this.joinableType = joinableType;
	this.lhsAlias = lhsAlias;
	this.lhsColumns = lhsColumns;
	this.rhsAlias = rhsAlias;
	this.joinType = joinType;
	this.joinable = joinableType.getAssociatedJoinable( factory );
	this.rhsColumns = JoinHelper.getRHSColumnNames( joinableType, factory );
	this.on = joinableType.getOnCondition( rhsAlias, factory, enabledFilters )
			+ ( withClause == null || withClause.trim().length() == 0 ? "" : " and ( " + withClause + " )" );
	this.hasRestriction = hasRestriction;
	this.enabledFilters = enabledFilters; // needed later for many-to-many/filter application
}
 
Example 2
Source File: LoadQueryJoinAndFetchProcessor.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private String resolveAdditionalJoinCondition(String rhsTableAlias, String withClause, Joinable joinable, AssociationType associationType) {
	// turns out that the call to AssociationType#getOnCondition in the initial code really just translates to
	// calls to the Joinable.filterFragment() method where the Joinable is either the entity or
	// collection persister
	final String filter = associationType!=null?
			associationType.getOnCondition( rhsTableAlias, factory, queryInfluencers.getEnabledFilters() ):
			joinable.filterFragment(
				rhsTableAlias,
				queryInfluencers.getEnabledFilters()
	);

	if ( StringHelper.isEmpty( withClause ) && StringHelper.isEmpty( filter ) ) {
		return "";
	}
	else if ( StringHelper.isNotEmpty( withClause ) && StringHelper.isNotEmpty( filter ) ) {
		return filter + " and " + withClause;
	}
	else {
		// only one is non-empty...
		return StringHelper.isNotEmpty( filter ) ? filter : withClause;
	}
}
 
Example 3
Source File: OuterJoinableAssociation.java    From cacheonix-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public OuterJoinableAssociation(
	AssociationType joinableType,
	String lhsAlias,
	String[] lhsColumns,
	String rhsAlias,
	int joinType,
	SessionFactoryImplementor factory,
	Map enabledFilters)
throws MappingException {
	this.joinableType = joinableType;
	this.lhsAlias = lhsAlias;
	this.lhsColumns = lhsColumns;
	this.rhsAlias = rhsAlias;
	this.joinType = joinType;
	this.joinable = joinableType.getAssociatedJoinable(factory);
	this.rhsColumns = JoinHelper.getRHSColumnNames(joinableType, factory);
	this.on = joinableType.getOnCondition(rhsAlias, factory, enabledFilters);
	this.enabledFilters = enabledFilters; // needed later for many-to-many/filter application
}