Java Code Examples for org.hibernate.sql.JoinFragment#toWhereFragmentString()

The following examples show how to use org.hibernate.sql.JoinFragment#toWhereFragmentString() . 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: JoinProcessor.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
private void addJoinNodes(QueryNode query, JoinSequence join, FromElement fromElement) {
	JoinFragment joinFragment = join.toJoinFragment(
			walker.getEnabledFilters(),
			fromElement.useFromFragment() || fromElement.isDereferencedBySuperclassOrSubclassProperty(),
			fromElement.getWithClauseFragment()
	);

	String frag = joinFragment.toFromFragmentString();
	String whereFrag = joinFragment.toWhereFragmentString();

	// If the from element represents a JOIN_FRAGMENT and it is
	// a theta-style join, convert its type from JOIN_FRAGMENT
	// to FROM_FRAGMENT
	if ( fromElement.getType() == JOIN_FRAGMENT &&
			( join.isThetaStyle() || StringHelper.isNotEmpty( whereFrag ) ) ) {
		fromElement.setType( FROM_FRAGMENT );
		fromElement.getJoinSequence().setUseThetaStyle( true ); // this is used during SqlGenerator processing
	}

	// If there is a FROM fragment and the FROM element is an explicit, then add the from part.
	if ( fromElement.useFromFragment() ||
			( fromElement.getFromClause().isSubQuery()
					&& fromElement.isDereferencedBySuperclassOrSubclassProperty() ) /*&& StringHelper.isNotEmpty( frag )*/ ) {
		String fromFragment = processFromFragment( frag, join ).trim();
		LOG.debugf( "Using FROM fragment [%s]", fromFragment );
		processDynamicFilterParameters(
				fromFragment,
				fromElement,
				walker
		);
	}

	syntheticAndFactory.addWhereFragment(
			joinFragment,
			whereFrag,
			query,
			fromElement,
			walker
	);
}
 
Example 2
Source File: JoinProcessor.java    From cacheonix-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void addJoinNodes(QueryNode query, JoinSequence join, FromElement fromElement, boolean inSubquery) {
	// Generate FROM and WHERE fragments for the from element.
	JoinFragment joinFragment = join.toJoinFragment(
			inSubquery ? Collections.EMPTY_MAP : queryTranslatorImpl.getEnabledFilters(),
			fromElement.useFromFragment() || fromElement.isDereferencedBySuperclassOrSubclassProperty(),
			fromElement.getWithClauseFragment(),
			fromElement.getWithClauseJoinAlias()
	);

	String frag = joinFragment.toFromFragmentString();
	String whereFrag = joinFragment.toWhereFragmentString();

	// If the from element represents a JOIN_FRAGMENT and it is
	// a theta-style join, convert its type from JOIN_FRAGMENT
	// to FROM_FRAGMENT
	if ( fromElement.getType() == JOIN_FRAGMENT &&
			( join.isThetaStyle() || StringHelper.isNotEmpty( whereFrag ) ) ) {
		fromElement.setType( FROM_FRAGMENT );
		fromElement.getJoinSequence().setUseThetaStyle( true ); // this is used during SqlGenerator processing
	}

	// If there is a FROM fragment and the FROM element is an explicit, then add the from part.
	if ( fromElement.useFromFragment() /*&& StringHelper.isNotEmpty( frag )*/ ) {
		String fromFragment = processFromFragment( frag, join );
		if ( log.isDebugEnabled() ) {
			log.debug( "Using FROM fragment [" + fromFragment + "]" );
		}
		fromElement.setText( fromFragment.trim() ); // Set the text of the fromElement.
	}
	andFactory.addWhereFragment( joinFragment, whereFrag, query, fromElement );
}
 
Example 3
Source File: JoinProcessor.java    From Knowage-Server with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addJoinNodes(QueryNode query, JoinSequence join, FromElement fromElement) {
	JoinFragment joinFragment = join.toJoinFragment(
			walker.getEnabledFilters(),
			fromElement.useFromFragment() || fromElement.isDereferencedBySuperclassOrSubclassProperty(),
			fromElement.getWithClauseFragment(),
			fromElement.getWithClauseJoinAlias()
	);

	String frag = joinFragment.toFromFragmentString();
	String whereFrag = joinFragment.toWhereFragmentString();

	// If the from element represents a JOIN_FRAGMENT and it is
	// a theta-style join, convert its type from JOIN_FRAGMENT
	// to FROM_FRAGMENT
	if ( fromElement.getType() == JOIN_FRAGMENT &&
			( join.isThetaStyle() /* || StringHelper.isNotEmpty( whereFrag ) */ ) ) {
		fromElement.setType( FROM_FRAGMENT );
		fromElement.getJoinSequence().setUseThetaStyle( true ); // this is used during SqlGenerator processing
	}

	// If there is a FROM fragment and the FROM element is an explicit, then add the from part.
	if ( fromElement.useFromFragment() /*&& StringHelper.isNotEmpty( frag )*/ ) {
		String fromFragment = processFromFragment( frag, join ).trim();
		if ( log.isDebugEnabled() ) {
			log.debug( "Using FROM fragment [" + fromFragment + "]" );
		}
		processDynamicFilterParameters(
				fromFragment,
				fromElement,
				walker
		);
	}

	syntheticAndFactory.addWhereFragment( 
			joinFragment,
			whereFrag,
			query,
			fromElement,
			walker
	);
}
 
Example 4
Source File: JoinProcessor.java    From Knowage-Server with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addJoinNodes(QueryNode query, JoinSequence join, FromElement fromElement) {
	JoinFragment joinFragment = join.toJoinFragment(
			walker.getEnabledFilters(),
			fromElement.useFromFragment() || fromElement.isDereferencedBySuperclassOrSubclassProperty(),
			fromElement.getWithClauseFragment(),
			fromElement.getWithClauseJoinAlias()
	);

	String frag = joinFragment.toFromFragmentString();
	String whereFrag = joinFragment.toWhereFragmentString();

	// If the from element represents a JOIN_FRAGMENT and it is
	// a theta-style join, convert its type from JOIN_FRAGMENT
	// to FROM_FRAGMENT
	if ( fromElement.getType() == JOIN_FRAGMENT &&
			( join.isThetaStyle() /* || StringHelper.isNotEmpty( whereFrag ) */ ) ) {
		fromElement.setType( FROM_FRAGMENT );
		fromElement.getJoinSequence().setUseThetaStyle( true ); // this is used during SqlGenerator processing
	}

	// If there is a FROM fragment and the FROM element is an explicit, then add the from part.
	if ( fromElement.useFromFragment() /*&& StringHelper.isNotEmpty( frag )*/ ) {
		String fromFragment = processFromFragment( frag, join ).trim();
		if ( log.isDebugEnabled() ) {
			log.debug( "Using FROM fragment [" + fromFragment + "]" );
		}
		processDynamicFilterParameters(
				fromFragment,
				fromElement,
				walker
		);
	}

	syntheticAndFactory.addWhereFragment( 
			joinFragment,
			whereFrag,
			query,
			fromElement,
			walker
	);
}
 
Example 5
Source File: JoinProcessor.java    From Knowage-Server with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addJoinNodes(QueryNode query, JoinSequence join, FromElement fromElement) {
	JoinFragment joinFragment = join.toJoinFragment(
			walker.getEnabledFilters(),
			fromElement.useFromFragment() || fromElement.isDereferencedBySuperclassOrSubclassProperty(),
			fromElement.getWithClauseFragment(),
			fromElement.getWithClauseJoinAlias()
	);

	String frag = joinFragment.toFromFragmentString();
	String whereFrag = joinFragment.toWhereFragmentString();

	// If the from element represents a JOIN_FRAGMENT and it is
	// a theta-style join, convert its type from JOIN_FRAGMENT
	// to FROM_FRAGMENT
	if ( fromElement.getType() == JOIN_FRAGMENT &&
			( join.isThetaStyle() /* || StringHelper.isNotEmpty( whereFrag ) */ ) ) {
		fromElement.setType( FROM_FRAGMENT );
		fromElement.getJoinSequence().setUseThetaStyle( true ); // this is used during SqlGenerator processing
	}

	// If there is a FROM fragment and the FROM element is an explicit, then add the from part.
	if ( fromElement.useFromFragment() /*&& StringHelper.isNotEmpty( frag )*/ ) {
		String fromFragment = processFromFragment( frag, join ).trim();
		if ( log.isDebugEnabled() ) {
			log.debug( "Using FROM fragment [" + fromFragment + "]" );
		}
		processDynamicFilterParameters(
				fromFragment,
				fromElement,
				walker
		);
	}

	syntheticAndFactory.addWhereFragment( 
			joinFragment,
			whereFrag,
			query,
			fromElement,
			walker
	);
}
 
Example 6
Source File: JoinProcessor.java    From Knowage-Server with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addJoinNodes(QueryNode query, JoinSequence join, FromElement fromElement) {
	JoinFragment joinFragment = join.toJoinFragment(
			walker.getEnabledFilters(),
			fromElement.useFromFragment() || fromElement.isDereferencedBySuperclassOrSubclassProperty(),
			fromElement.getWithClauseFragment(),
			fromElement.getWithClauseJoinAlias()
	);

	String frag = joinFragment.toFromFragmentString();
	String whereFrag = joinFragment.toWhereFragmentString();

	// If the from element represents a JOIN_FRAGMENT and it is
	// a theta-style join, convert its type from JOIN_FRAGMENT
	// to FROM_FRAGMENT
	if ( fromElement.getType() == JOIN_FRAGMENT &&
			( join.isThetaStyle() /* || StringHelper.isNotEmpty( whereFrag ) */ ) ) {
		fromElement.setType( FROM_FRAGMENT );
		fromElement.getJoinSequence().setUseThetaStyle( true ); // this is used during SqlGenerator processing
	}

	// If there is a FROM fragment and the FROM element is an explicit, then add the from part.
	if ( fromElement.useFromFragment() /*&& StringHelper.isNotEmpty( frag )*/ ) {
		String fromFragment = processFromFragment( frag, join ).trim();
		if ( log.isDebugEnabled() ) {
			log.debug( "Using FROM fragment [" + fromFragment + "]" );
		}
		processDynamicFilterParameters(
				fromFragment,
				fromElement,
				walker
		);
	}

	syntheticAndFactory.addWhereFragment( 
			joinFragment,
			whereFrag,
			query,
			fromElement,
			walker
	);
}
 
Example 7
Source File: JoinProcessor.java    From Knowage-Server with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addJoinNodes(QueryNode query, JoinSequence join, FromElement fromElement) {
	JoinFragment joinFragment = join.toJoinFragment(
			walker.getEnabledFilters(),
			fromElement.useFromFragment() || fromElement.isDereferencedBySuperclassOrSubclassProperty(),
			fromElement.getWithClauseFragment(),
			fromElement.getWithClauseJoinAlias()
	);

	String frag = joinFragment.toFromFragmentString();
	String whereFrag = joinFragment.toWhereFragmentString();

	// If the from element represents a JOIN_FRAGMENT and it is
	// a theta-style join, convert its type from JOIN_FRAGMENT
	// to FROM_FRAGMENT
	if ( fromElement.getType() == JOIN_FRAGMENT &&
			( join.isThetaStyle() /* || StringHelper.isNotEmpty( whereFrag ) */ ) ) {
		fromElement.setType( FROM_FRAGMENT );
		fromElement.getJoinSequence().setUseThetaStyle( true ); // this is used during SqlGenerator processing
	}

	// If there is a FROM fragment and the FROM element is an explicit, then add the from part.
	if ( fromElement.useFromFragment() /*&& StringHelper.isNotEmpty( frag )*/ ) {
		String fromFragment = processFromFragment( frag, join ).trim();
		if ( log.isDebugEnabled() ) {
			log.debug( "Using FROM fragment [" + fromFragment + "]" );
		}
		processDynamicFilterParameters(
				fromFragment,
				fromElement,
				walker
		);
	}

	syntheticAndFactory.addWhereFragment( 
			joinFragment,
			whereFrag,
			query,
			fromElement,
			walker
	);
}
 
Example 8
Source File: JoinProcessor.java    From Knowage-Server with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addJoinNodes(QueryNode query, JoinSequence join, FromElement fromElement) {
	JoinFragment joinFragment = join.toJoinFragment(
			walker.getEnabledFilters(),
			fromElement.useFromFragment() || fromElement.isDereferencedBySuperclassOrSubclassProperty(),
			fromElement.getWithClauseFragment(),
			fromElement.getWithClauseJoinAlias()
	);

	String frag = joinFragment.toFromFragmentString();
	String whereFrag = joinFragment.toWhereFragmentString();

	// If the from element represents a JOIN_FRAGMENT and it is
	// a theta-style join, convert its type from JOIN_FRAGMENT
	// to FROM_FRAGMENT
	if ( fromElement.getType() == JOIN_FRAGMENT &&
			( join.isThetaStyle() /* || StringHelper.isNotEmpty( whereFrag ) */ ) ) {
		fromElement.setType( FROM_FRAGMENT );
		fromElement.getJoinSequence().setUseThetaStyle( true ); // this is used during SqlGenerator processing
	}

	// If there is a FROM fragment and the FROM element is an explicit, then add the from part.
	if ( fromElement.useFromFragment() /*&& StringHelper.isNotEmpty( frag )*/ ) {
		String fromFragment = processFromFragment( frag, join ).trim();
		if ( log.isDebugEnabled() ) {
			log.debug( "Using FROM fragment [" + fromFragment + "]" );
		}
		processDynamicFilterParameters(
				fromFragment,
				fromElement,
				walker
		);
	}

	syntheticAndFactory.addWhereFragment( 
			joinFragment,
			whereFrag,
			query,
			fromElement,
			walker
	);
}
 
Example 9
Source File: JoinProcessor.java    From Knowage-Server with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addJoinNodes(QueryNode query, JoinSequence join, FromElement fromElement) {
	JoinFragment joinFragment = join.toJoinFragment(
			walker.getEnabledFilters(),
			fromElement.useFromFragment() || fromElement.isDereferencedBySuperclassOrSubclassProperty(),
			fromElement.getWithClauseFragment(),
			fromElement.getWithClauseJoinAlias()
	);

	String frag = joinFragment.toFromFragmentString();
	String whereFrag = joinFragment.toWhereFragmentString();

	// If the from element represents a JOIN_FRAGMENT and it is
	// a theta-style join, convert its type from JOIN_FRAGMENT
	// to FROM_FRAGMENT
	if ( fromElement.getType() == JOIN_FRAGMENT &&
			( join.isThetaStyle() /* || StringHelper.isNotEmpty( whereFrag ) */ ) ) {
		fromElement.setType( FROM_FRAGMENT );
		fromElement.getJoinSequence().setUseThetaStyle( true ); // this is used during SqlGenerator processing
	}

	// If there is a FROM fragment and the FROM element is an explicit, then add the from part.
	if ( fromElement.useFromFragment() /*&& StringHelper.isNotEmpty( frag )*/ ) {
		String fromFragment = processFromFragment( frag, join ).trim();
		if ( log.isDebugEnabled() ) {
			log.debug( "Using FROM fragment [" + fromFragment + "]" );
		}
		processDynamicFilterParameters(
				fromFragment,
				fromElement,
				walker
		);
	}

	syntheticAndFactory.addWhereFragment( 
			joinFragment,
			whereFrag,
			query,
			fromElement,
			walker
	);
}
 
Example 10
Source File: JoinProcessor.java    From Knowage-Server with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addJoinNodes(QueryNode query, JoinSequence join, FromElement fromElement) {
	JoinFragment joinFragment = join.toJoinFragment(
			walker.getEnabledFilters(),
			fromElement.useFromFragment() || fromElement.isDereferencedBySuperclassOrSubclassProperty(),
			fromElement.getWithClauseFragment(),
			fromElement.getWithClauseJoinAlias()
	);

	String frag = joinFragment.toFromFragmentString();
	String whereFrag = joinFragment.toWhereFragmentString();

	// If the from element represents a JOIN_FRAGMENT and it is
	// a theta-style join, convert its type from JOIN_FRAGMENT
	// to FROM_FRAGMENT
	if ( fromElement.getType() == JOIN_FRAGMENT &&
			( join.isThetaStyle() /* || StringHelper.isNotEmpty( whereFrag ) */ ) ) {
		fromElement.setType( FROM_FRAGMENT );
		fromElement.getJoinSequence().setUseThetaStyle( true ); // this is used during SqlGenerator processing
	}

	// If there is a FROM fragment and the FROM element is an explicit, then add the from part.
	if ( fromElement.useFromFragment() /*&& StringHelper.isNotEmpty( frag )*/ ) {
		String fromFragment = processFromFragment( frag, join ).trim();
		if ( log.isDebugEnabled() ) {
			log.debug( "Using FROM fragment [" + fromFragment + "]" );
		}
		processDynamicFilterParameters(
				fromFragment,
				fromElement,
				walker
		);
	}

	syntheticAndFactory.addWhereFragment( 
			joinFragment,
			whereFrag,
			query,
			fromElement,
			walker
	);
}
 
Example 11
Source File: JoinProcessor.java    From Knowage-Server with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addJoinNodes(QueryNode query, JoinSequence join, FromElement fromElement) {
	JoinFragment joinFragment = join.toJoinFragment(
			walker.getEnabledFilters(),
			fromElement.useFromFragment() || fromElement.isDereferencedBySuperclassOrSubclassProperty(),
			fromElement.getWithClauseFragment(),
			fromElement.getWithClauseJoinAlias()
	);

	String frag = joinFragment.toFromFragmentString();
	String whereFrag = joinFragment.toWhereFragmentString();

	// If the from element represents a JOIN_FRAGMENT and it is
	// a theta-style join, convert its type from JOIN_FRAGMENT
	// to FROM_FRAGMENT
	if ( fromElement.getType() == JOIN_FRAGMENT &&
			( join.isThetaStyle() /* || StringHelper.isNotEmpty( whereFrag ) */ ) ) {
		fromElement.setType( FROM_FRAGMENT );
		fromElement.getJoinSequence().setUseThetaStyle( true ); // this is used during SqlGenerator processing
	}

	// If there is a FROM fragment and the FROM element is an explicit, then add the from part.
	if ( fromElement.useFromFragment() /*&& StringHelper.isNotEmpty( frag )*/ ) {
		String fromFragment = processFromFragment( frag, join ).trim();
		if ( log.isDebugEnabled() ) {
			log.debug( "Using FROM fragment [" + fromFragment + "]" );
		}
		processDynamicFilterParameters(
				fromFragment,
				fromElement,
				walker
		);
	}

	syntheticAndFactory.addWhereFragment( 
			joinFragment,
			whereFrag,
			query,
			fromElement,
			walker
	);
}
 
Example 12
Source File: JoinProcessor.java    From Knowage-Server with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addJoinNodes(QueryNode query, JoinSequence join, FromElement fromElement) {
	JoinFragment joinFragment = join.toJoinFragment(
			walker.getEnabledFilters(),
			fromElement.useFromFragment() || fromElement.isDereferencedBySuperclassOrSubclassProperty(),
			fromElement.getWithClauseFragment(),
			fromElement.getWithClauseJoinAlias()
	);

	String frag = joinFragment.toFromFragmentString();
	String whereFrag = joinFragment.toWhereFragmentString();

	// If the from element represents a JOIN_FRAGMENT and it is
	// a theta-style join, convert its type from JOIN_FRAGMENT
	// to FROM_FRAGMENT
	if ( fromElement.getType() == JOIN_FRAGMENT &&
			( join.isThetaStyle() /* || StringHelper.isNotEmpty( whereFrag ) */ ) ) {
		fromElement.setType( FROM_FRAGMENT );
		fromElement.getJoinSequence().setUseThetaStyle( true ); // this is used during SqlGenerator processing
	}

	// If there is a FROM fragment and the FROM element is an explicit, then add the from part.
	if ( fromElement.useFromFragment() /*&& StringHelper.isNotEmpty( frag )*/ ) {
		String fromFragment = processFromFragment( frag, join ).trim();
		if ( log.isDebugEnabled() ) {
			log.debug( "Using FROM fragment [" + fromFragment + "]" );
		}
		processDynamicFilterParameters(
				fromFragment,
				fromElement,
				walker
		);
	}

	syntheticAndFactory.addWhereFragment( 
			joinFragment,
			whereFrag,
			query,
			fromElement,
			walker
	);
}
 
Example 13
Source File: JoinProcessor.java    From Knowage-Server with GNU Affero General Public License v3.0 4 votes vote down vote up
private void addJoinNodes(QueryNode query, JoinSequence join, FromElement fromElement) {
	JoinFragment joinFragment = join.toJoinFragment(
			walker.getEnabledFilters(),
			fromElement.useFromFragment() || fromElement.isDereferencedBySuperclassOrSubclassProperty(),
			fromElement.getWithClauseFragment(),
			fromElement.getWithClauseJoinAlias()
	);

	String frag = joinFragment.toFromFragmentString();
	String whereFrag = joinFragment.toWhereFragmentString();

	// If the from element represents a JOIN_FRAGMENT and it is
	// a theta-style join, convert its type from JOIN_FRAGMENT
	// to FROM_FRAGMENT
	if ( fromElement.getType() == JOIN_FRAGMENT &&
			( join.isThetaStyle() /* || StringHelper.isNotEmpty( whereFrag ) */ ) ) {
		fromElement.setType( FROM_FRAGMENT );
		fromElement.getJoinSequence().setUseThetaStyle( true ); // this is used during SqlGenerator processing
	}

	// If there is a FROM fragment and the FROM element is an explicit, then add the from part.
	if ( fromElement.useFromFragment() /*&& StringHelper.isNotEmpty( frag )*/ ) {
		String fromFragment = processFromFragment( frag, join ).trim();
		if ( log.isDebugEnabled() ) {
			log.debug( "Using FROM fragment [" + fromFragment + "]" );
		}
		processDynamicFilterParameters(
				fromFragment,
				fromElement,
				walker
		);
	}

	syntheticAndFactory.addWhereFragment( 
			joinFragment,
			whereFrag,
			query,
			fromElement,
			walker
	);
}