Integer languageId = getSettingService().getConfig(SettingKey.ADMIN_LANGUAGE_ID, Integer.class);
String sql = "SELECT *, (SELECT agd.name FROM "+quoteTable("attribute_group_description")
+" agd WHERE agd.attribute_group_id = a.attribute_group_id AND agd.language_id = ?) AS attribute_group FROM "
+quoteTable("attribute")+ " a LEFT JOIN " +quoteTable("attribute_description")+ " ad ON (a.attribute_id = ad.attribute_id) WHERE ad.language_id =?";
//sortedKeys={"ad.name", "attribute_group", "a.sort_order"}
QueryBean query = createPaginationQuery(sql, pageParam);
query.addParameters(languageId, languageId);
return getJdbcOperations().query(query.getSql(),
query.getParameters(), new AttributeRowMapper(){
@Override
public Attribute mapRow(ResultSet rs, int rowNum)
throws SQLException {
Attribute attr = super.mapRow(rs, rowNum);
attr.setName(rs.getString("name"));