1 package org.hibernate.loader.collection; 3 4 import java.util.Map ; 5 6 import org.hibernate.engine.SessionFactoryImplementor; 7 import org.hibernate.loader.JoinWalker; 8 import org.hibernate.util.StringHelper; 9 10 18 public abstract class CollectionJoinWalker extends JoinWalker { 19 20 private final String subselect; 21 22 public CollectionJoinWalker(String subselect, SessionFactoryImplementor factory, Map enabledFilters) { 23 super( factory, enabledFilters ); 24 this.subselect = subselect; 25 } 26 27 protected StringBuffer whereString(String alias, String [] columnNames, int batchSize) { 28 if (subselect==null) { 29 return super.whereString(alias, columnNames, batchSize); 30 } 31 else { 32 StringBuffer buf = new StringBuffer (); 33 if (columnNames.length>1) buf.append('('); 34 buf.append( StringHelper.join(", ", StringHelper.qualify(alias, columnNames) ) ); 35 if (columnNames.length>1) buf.append(')'); 36 buf.append(" in ") 37 .append('(') 38 .append(subselect) 39 .append(')'); 40 return buf; 41 } 42 } 43 } 44 | Popular Tags |