@Override public String whereJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses) { // NOTE : Not calling createJoin here is just a performance optimization return getSubclassTableSpan() == 1 ? "" : createJoin( alias, innerJoin, includeSubclasses, Collections.emptySet() ).toWhereFragmentString(); }
@Override public String whereJoinFragment( String alias, boolean innerJoin, boolean includeSubclasses, Set<String> treatAsDeclarations) { // NOTE : Not calling createJoin here is just a performance optimization return getSubclassTableSpan() == 1 ? "" : createJoin( alias, innerJoin, includeSubclasses, treatAsDeclarations ).toWhereFragmentString(); }
public static String createCollectionSubquery( JoinSequence joinSequence, Map enabledFilters, String[] columns) { try { JoinFragment join = joinSequence.toJoinFragment( enabledFilters, true ); return "select " + String.join( ", ", columns ) + " from " + join.toFromFragmentString().substring( 2 ) + " where " + join.toWhereFragmentString().substring( 5 ); } catch (MappingException me) { throw new QueryException( me ); } } }
private void addToCurrentJoin(PathExpressionParser.CollectionElement ce) throws QueryException { try { addToCurrentJoin( ce.joinSequence.toJoinFragment().toWhereFragmentString() + ce.indexValue.toString() ); } catch ( MappingException me ) { throw new QueryException( me ); } }
.append( from ); String outerJoinsAfterWhere = joins.toWhereFragmentString().trim(); String whereConditions = where.toString().trim(); boolean hasOuterJoinsAfterWhere = outerJoinsAfterWhere.length() > 0;
/** * Adds another join fragment to this one. * * @param ojf The other join fragment */ public void addFragment(JoinFragment ojf) { if ( ojf.hasThetaJoins() ) { hasThetaJoins = true; } addJoins( ojf.toFromFragmentString(), ojf.toWhereFragmentString() ); }
public void processQuerySpaceJoins(QuerySpace querySpace, SelectStatementBuilder selectStatementBuilder) { LOG.debug( "processing queryspace " + querySpace.getUid() ); final JoinFragment joinFragment = factory.getDialect().createOuterJoinFragment(); processQuerySpaceJoins( querySpace, joinFragment ); selectStatementBuilder.setOuterJoins( joinFragment.toFromFragmentString(), joinFragment.toWhereFragmentString() ); }
private void addJoin(JoinSequence joinSequence, QueryTranslatorImpl q) throws QueryException { //JoinFragment fromClause = q.createJoinFragment(true); //fromClause.addJoins( join.toJoinFragment().toFromFragmentString(), StringHelper.EMPTY_STRING ); q.addFromJoinOnly( pathExpressionParser.getName(), joinSequence ); try { addToCurrentJoin( joinSequence.toJoinFragment( q.getEnabledFilters(), true ).toWhereFragmentString() ); } catch ( MappingException me ) { throw new QueryException( me ); } }
JoinSequence ojf = q.getPathJoin( path.toString() ); try { joinSequence.addCondition( ojf.toJoinFragment( q.getEnabledFilters(), true ).toWhereFragmentString() ); //after reset!
protected String renderSelect( final int[] tableNumbers, final int[] columnNumbers, final int[] formulaNumbers) { Arrays.sort( tableNumbers ); //get 'em in the right order (not that it really matters) //render the where and from parts int drivingTable = tableNumbers[0]; final String drivingAlias = generateTableAlias( getRootAlias(), drivingTable ); //we *could* regerate this inside each called method! final String where = createWhereByKey( drivingTable, drivingAlias ); final String from = createFrom( drivingTable, drivingAlias ); //now render the joins JoinFragment jf = createJoin( tableNumbers, drivingAlias ); //now render the select clause SelectFragment selectFragment = createSelect( columnNumbers, formulaNumbers ); //now tie it all together Select select = new Select( getFactory().getDialect() ); select.setSelectClause( selectFragment.toFragmentString().substring( 2 ) ); select.setFromClause( from ); select.setWhereClause( where ); select.setOuterJoins( jf.toFromFragmentString(), jf.toWhereFragmentString() ); if ( getFactory().getSessionFactoryOptions().isCommentsEnabled() ) { select.setComment( "sequential select " + getEntityName() ); } return select.toStatementString(); }
String whereFrag = joinFragment.toWhereFragmentString();
.setOuterJoins( ojf.toFromFragmentString(), ojf.toWhereFragmentString() );
.setOuterJoins( ojf.toFromFragmentString(), ojf.toWhereFragmentString() + elementPersister.whereJoinFragment( alias, true, true ) );
.setOuterJoins( ojf.toFromFragmentString(), ojf.toWhereFragmentString() + getWhereFragment()
public String whereJoinFragment(String alias, boolean innerJoin, boolean includeSubclasses) { return getSubclassTableSpan() == 1 ? "" : //just a performance opt! createJoin( alias, innerJoin, includeSubclasses ).toWhereFragmentString(); }
private void addToCurrentJoin(PathExpressionParser.CollectionElement ce) throws QueryException { try { addToCurrentJoin( ce.joinSequence.toJoinFragment().toWhereFragmentString() + ce.indexValue.toString() ); } catch ( MappingException me ) { throw new QueryException( me ); } }
private void addToCurrentJoin(PathExpressionParser.CollectionElement ce) throws QueryException { try { addToCurrentJoin( ce.joinSequence.toJoinFragment().toWhereFragmentString() + ce.indexValue.toString() ); } catch ( MappingException me ) { throw new QueryException( me ); } }
private void addToCurrentJoin(PathExpressionParser.CollectionElement ce) throws QueryException { try { addToCurrentJoin( ce.joinSequence.toJoinFragment().toWhereFragmentString() + ce.indexValue.toString() ); } catch ( MappingException me ) { throw new QueryException( me ); } }
/** * Adds another join fragment to this one. * * @param ojf The other join fragment */ public void addFragment(JoinFragment ojf) { if ( ojf.hasThetaJoins() ) { hasThetaJoins = true; } addJoins( ojf.toFromFragmentString(), ojf.toWhereFragmentString() ); }
private void addJoin(JoinSequence joinSequence, QueryTranslatorImpl q) throws QueryException { //JoinFragment fromClause = q.createJoinFragment(true); //fromClause.addJoins( join.toJoinFragment().toFromFragmentString(), StringHelper.EMPTY_STRING ); q.addFromJoinOnly( pathExpressionParser.getName(), joinSequence ); try { addToCurrentJoin( joinSequence.toJoinFragment( q.getEnabledFilters(), true ).toWhereFragmentString() ); } catch ( MappingException me ) { throw new QueryException( me ); } }