1 package org.hibernate.hql; 3 4 import org.hibernate.engine.JoinSequence; 5 import org.hibernate.sql.JoinFragment; 6 import org.hibernate.MappingException; 7 import org.hibernate.QueryException; 8 import org.hibernate.util.StringHelper; 9 10 import java.util.Map ; 11 12 18 public final class CollectionSubqueryFactory { 19 20 private CollectionSubqueryFactory() { 21 } 22 23 public static String createCollectionSubquery(JoinSequence joinSequence, Map enabledFilters, String [] columns) { 24 JoinFragment join; 26 try { 27 join = joinSequence.toJoinFragment( enabledFilters, true ); 28 } 29 catch ( MappingException me ) { 30 throw new QueryException( me ); 31 } 32 return new StringBuffer ( "select " ) 33 .append( StringHelper.join( ", ", columns ) ) 34 .append( " from " ) 35 38 .append( join.toFromFragmentString().substring( 2 ) ) .append( " where " ) 40 .append( join.toWhereFragmentString().substring( 5 ) ) .toString(); 42 } 43 } 44 | Popular Tags |