/** * Generate a JoinFragment * * @return The JoinFragment * * @throws MappingException Indicates a problem access the provided metadata, or incorrect metadata */ public JoinFragment toJoinFragment() throws MappingException { return toJoinFragment( Collections.EMPTY_MAP, true ); }
/** * Generate a JoinFragment * * @param enabledFilters The filters associated with the originating session to properly define join conditions * @param includeAllSubclassJoins Should all subclass joins be added to the rendered JoinFragment? * * @return The JoinFragment * * @throws MappingException Indicates a problem access the provided metadata, or incorrect metadata */ public JoinFragment toJoinFragment(Map enabledFilters, boolean includeAllSubclassJoins) throws MappingException { return toJoinFragment( enabledFilters, includeAllSubclassJoins, null ); }
private void mergeJoins(JoinFragment ojf) throws MappingException, QueryException { Iterator iter = joins.entrySet().iterator(); while ( iter.hasNext() ) { Map.Entry me = (Map.Entry) iter.next(); String name = (String) me.getKey(); JoinSequence join = (JoinSequence) me.getValue(); join.setSelector( new JoinSequence.Selector() { @Override public boolean includeSubclasses(String alias) { return returnedTypes.contains( alias ) && !isShallowQuery(); } } ); if ( typeMap.containsKey( name ) ) { ojf.addFragment( join.toJoinFragment( enabledFilters, true ) ); } else if ( collections.containsKey( name ) ) { ojf.addFragment( join.toJoinFragment( enabledFilters, true ) ); } } }
private void addToCurrentJoin(PathExpressionParser.CollectionElement ce) throws QueryException { try { addToCurrentJoin( ce.joinSequence.toJoinFragment().toWhereFragmentString() + ce.indexValue.toString() ); } catch ( MappingException me ) { throw new QueryException( me ); } }
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 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!
private void addJoinNodes(QueryNode query, JoinSequence join, FromElement fromElement) { JoinFragment joinFragment = join.toJoinFragment( walker.getEnabledFilters(), fromElement.useFromFragment() || fromElement.isDereferencedBySuperclassOrSubclassProperty(),
joinFragment.addFragment( next.toJoinFragment( enabledFilters, includeAllSubclassJoins ) );
public JoinFragment toJoinFragment() throws MappingException { return toJoinFragment( CollectionHelper.EMPTY_MAP, true ); }
public JoinFragment toJoinFragment() throws MappingException { return toJoinFragment( CollectionHelper.EMPTY_MAP, true ); }
private void mergeJoins(JoinFragment ojf) throws MappingException, QueryException { Iterator iter = joins.entrySet().iterator(); while ( iter.hasNext() ) { Map.Entry me = ( Map.Entry ) iter.next(); String name = ( String ) me.getKey(); JoinSequence join = ( JoinSequence ) me.getValue(); join.setSelector( new JoinSequence.Selector() { public boolean includeSubclasses(String alias) { boolean include = returnedTypes.contains( alias ) && !isShallowQuery(); return include; } } ); if ( typeMap.containsKey( name ) ) { ojf.addFragment( join.toJoinFragment( enabledFilters, true ) ); } else if ( collections.containsKey( name ) ) { ojf.addFragment( join.toJoinFragment( enabledFilters, true ) ); } else { //name from a super query (a bit inelegant that it shows up here) } } }
private void mergeJoins(JoinFragment ojf) throws MappingException, QueryException { Iterator iter = joins.entrySet().iterator(); while ( iter.hasNext() ) { Map.Entry me = ( Map.Entry ) iter.next(); String name = ( String ) me.getKey(); JoinSequence join = ( JoinSequence ) me.getValue(); join.setSelector( new JoinSequence.Selector() { public boolean includeSubclasses(String alias) { boolean include = returnedTypes.contains( alias ) && !isShallowQuery(); return include; } } ); if ( typeMap.containsKey( name ) ) { ojf.addFragment( join.toJoinFragment( enabledFilters, true ) ); } else if ( collections.containsKey( name ) ) { ojf.addFragment( join.toJoinFragment( enabledFilters, true ) ); } else { //name from a super query (a bit inelegant that it shows up here) } } }
public static String createCollectionSubquery( JoinSequence joinSequence, Map enabledFilters, String[] columns) { try { JoinFragment join = joinSequence.toJoinFragment( enabledFilters, true ); return new StringBuffer( "select " ) .append( StringHelper.join( ", ", columns ) ) .append( " from " ) .append( join.toFromFragmentString().substring( 2 ) )// remove initial ", " .append( " where " ) .append( join.toWhereFragmentString().substring( 5 ) )// remove initial " and " .toString(); } catch ( MappingException me ) { throw new QueryException( me ); } } }
public static String createCollectionSubquery( JoinSequence joinSequence, Map enabledFilters, String[] columns) { try { JoinFragment join = joinSequence.toJoinFragment( enabledFilters, true ); return new StringBuffer( "select " ) .append( StringHelper.join( ", ", columns ) ) .append( " from " ) .append( join.toFromFragmentString().substring( 2 ) )// remove initial ", " .append( " where " ) .append( join.toWhereFragmentString().substring( 5 ) )// remove initial " and " .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 ); } }
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 ); } }
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 ); } }
private void addJoinNodes(QueryNode query, JoinSequence join, FromElement fromElement) { JoinFragment joinFragment = join.toJoinFragment( walker.getEnabledFilters(), fromElement.useFromFragment() || fromElement.isDereferencedBySuperclassOrSubclassProperty(),