protected com.liferay.portal.model.Address[] findByC_C_C_PrevAndNext(
String addressId, String companyId, String className, String classPK,
OrderByComparator obc) throws NoSuchAddressException, SystemException {
com.liferay.portal.model.Address address = findByPrimaryKey(addressId);
int count = countByC_C_C(companyId, className, classPK);
Session session = null;
try {
session = openSession();
StringBuffer query = new StringBuffer();
query.append(
"FROM Address IN CLASS com.liferay.portal.ejb.AddressHBM WHERE ");
query.append("companyId = ?");
query.append(" AND ");
query.append("className = ?");
query.append(" AND ");
query.append("classPK = ?");
query.append(" ");
if (obc != null) {
query.append("ORDER BY " + obc.getOrderBy());
}
else {
query.append("ORDER BY ");
query.append("companyId ASC").append(", ");
query.append("className ASC").append(", ");
query.append("classPK ASC").append(", ");
query.append("priority ASC");
}
Query q = session.createQuery(query.toString());
int queryPos = 0;
q.setString(queryPos++, companyId);
q.setString(queryPos++, className);
q.setString(queryPos++, classPK);