package org.hibernate.criterion;
import org.hibernate.Criteria;
public class PropertiesSubqueryExpression extends SubqueryExpression {
private final String[] propertyNames;
protected PropertiesSubqueryExpression(String[] propertyNames, String op, DetachedCriteria dc) {
super( op, null, dc );
this.propertyNames = propertyNames;
}
@Override
protected String toLeftSqlString(Criteria criteria, CriteriaQuery outerQuery) {
final StringBuilder left = new StringBuilder( "(" );
final String[] sqlColumnNames = new String[propertyNames.length];
for ( int i = 0; i < sqlColumnNames.length; ++i ) {
sqlColumnNames[i] = outerQuery.getColumn( criteria, propertyNames[i] );
}
left.append( String.join( ", ", sqlColumnNames ) );
return left.append( ")" ).toString();
}
}