* Creates SELECT criteria for the entity matched by foreign key.
* Foreign key is created by concatenating foreign table name and column name.
*/
public static DbSqlBuilder findForeign(Class entity, Object value) {
String tableRef = createTableRefName(entity);
DbOomManager dbOomManager = DbOomManager.getInstance();
DbEntityDescriptor dedFk = dbOomManager.lookupType(value.getClass());
String tableName = dbOomManager.getTableNames().convertTableNameToEntityName(dedFk.getTableName());
String columnName = dbOomManager.getColumnNames().convertColumnNameToPropertyName(dedFk.getIdColumnName());
String fkColumn = uncapitalize(tableName) + capitalize(columnName);
Object idValue = BeanUtil.getProperty(value, dedFk.getIdPropertyName());
return sql()._(SELECT).column(tableRef)._(FROM).table(entity, tableRef)._(WHERE).ref(tableRef, fkColumn)._(EQUALS).columnValue(idValue);
}