Example usage for com.liferay.portal.kernel.util OrderByComparator getOrderBy

List of usage examples for com.liferay.portal.kernel.util OrderByComparator getOrderBy

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util OrderByComparator getOrderBy.

Prototype

public String getOrderBy() 

Source Link

Usage

From source file:com.beorn.onlinepayment.service.persistence.PaymentMethodPersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the payment plugins associated with the payment method.
 *
 * <p>//from  w  w w  . j a  v  a2s  .  c  o m
 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
 * </p>
 *
 * @param pk the primary key of the payment method
 * @param start the lower bound of the range of payment methods
 * @param end the upper bound of the range of payment methods (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of payment plugins associated with the payment method
 * @throws SystemException if a system exception occurred
 */
public List<com.beorn.onlinepayment.model.PaymentPlugin> getPaymentPlugins(long pk, int start, int end,
        OrderByComparator orderByComparator) throws SystemException {
    Object[] finderArgs = new Object[] { pk, start, end, orderByComparator };

    List<com.beorn.onlinepayment.model.PaymentPlugin> list = (List<com.beorn.onlinepayment.model.PaymentPlugin>) FinderCacheUtil
            .getResult(FINDER_PATH_GET_PAYMENTPLUGINS, finderArgs, this);

    if (list == null) {
        Session session = null;

        try {
            session = openSession();

            String sql = null;

            if (orderByComparator != null) {
                sql = _SQL_GETPAYMENTPLUGINS.concat(ORDER_BY_CLAUSE).concat(orderByComparator.getOrderBy());
            } else {
                sql = _SQL_GETPAYMENTPLUGINS
                        .concat(com.beorn.onlinepayment.model.impl.PaymentPluginModelImpl.ORDER_BY_SQL);
            }

            SQLQuery q = session.createSQLQuery(sql);

            q.addEntity("Payment_PaymentPlugin", com.beorn.onlinepayment.model.impl.PaymentPluginImpl.class);

            QueryPos qPos = QueryPos.getInstance(q);

            qPos.add(pk);

            list = (List<com.beorn.onlinepayment.model.PaymentPlugin>) QueryUtil.list(q, getDialect(), start,
                    end);
        } catch (Exception e) {
            throw processException(e);
        } finally {
            if (list == null) {
                FinderCacheUtil.removeResult(FINDER_PATH_GET_PAYMENTPLUGINS, finderArgs);
            } else {
                paymentPluginPersistence.cacheResult(list);

                FinderCacheUtil.putResult(FINDER_PATH_GET_PAYMENTPLUGINS, finderArgs, list);
            }

            closeSession(session);
        }
    }

    return list;
}

From source file:com.beorn.onlinepayment.service.persistence.PaymentPluginConfigPersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the rules associated with the payment plugin config.
 *
 * <p>/*from w  w w  . j a va 2s.c  o  m*/
 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
 * </p>
 *
 * @param pk the primary key of the payment plugin config
 * @param start the lower bound of the range of payment plugin configs
 * @param end the upper bound of the range of payment plugin configs (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of rules associated with the payment plugin config
 * @throws SystemException if a system exception occurred
 */
public List<com.beorn.onlinepayment.model.Rule> getRules(long pk, int start, int end,
        OrderByComparator orderByComparator) throws SystemException {
    Object[] finderArgs = new Object[] { pk, start, end, orderByComparator };

    List<com.beorn.onlinepayment.model.Rule> list = (List<com.beorn.onlinepayment.model.Rule>) FinderCacheUtil
            .getResult(FINDER_PATH_GET_RULES, finderArgs, this);

    if (list == null) {
        Session session = null;

        try {
            session = openSession();

            String sql = null;

            if (orderByComparator != null) {
                sql = _SQL_GETRULES.concat(ORDER_BY_CLAUSE).concat(orderByComparator.getOrderBy());
            } else {
                sql = _SQL_GETRULES.concat(com.beorn.onlinepayment.model.impl.RuleModelImpl.ORDER_BY_SQL);
            }

            SQLQuery q = session.createSQLQuery(sql);

            q.addEntity("Payment_Rule", com.beorn.onlinepayment.model.impl.RuleImpl.class);

            QueryPos qPos = QueryPos.getInstance(q);

            qPos.add(pk);

            list = (List<com.beorn.onlinepayment.model.Rule>) QueryUtil.list(q, getDialect(), start, end);
        } catch (Exception e) {
            throw processException(e);
        } finally {
            if (list == null) {
                FinderCacheUtil.removeResult(FINDER_PATH_GET_RULES, finderArgs);
            } else {
                rulePersistence.cacheResult(list);

                FinderCacheUtil.putResult(FINDER_PATH_GET_RULES, finderArgs, list);
            }

            closeSession(session);
        }
    }

    return list;
}

From source file:com.beorn.onlinepayment.service.persistence.PaymentPluginPersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the payment plugin configs associated with the payment plugin.
 *
 * <p>/*from  ww w.  jav  a2s  .  c  o m*/
 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
 * </p>
 *
 * @param pk the primary key of the payment plugin
 * @param start the lower bound of the range of payment plugins
 * @param end the upper bound of the range of payment plugins (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of payment plugin configs associated with the payment plugin
 * @throws SystemException if a system exception occurred
 */
public List<com.beorn.onlinepayment.model.PaymentPluginConfig> getPaymentPluginConfigs(long pk, int start,
        int end, OrderByComparator orderByComparator) throws SystemException {
    Object[] finderArgs = new Object[] { pk, start, end, orderByComparator };

    List<com.beorn.onlinepayment.model.PaymentPluginConfig> list = (List<com.beorn.onlinepayment.model.PaymentPluginConfig>) FinderCacheUtil
            .getResult(FINDER_PATH_GET_PAYMENTPLUGINCONFIGS, finderArgs, this);

    if (list == null) {
        Session session = null;

        try {
            session = openSession();

            String sql = null;

            if (orderByComparator != null) {
                sql = _SQL_GETPAYMENTPLUGINCONFIGS.concat(ORDER_BY_CLAUSE)
                        .concat(orderByComparator.getOrderBy());
            } else {
                sql = _SQL_GETPAYMENTPLUGINCONFIGS
                        .concat(com.beorn.onlinepayment.model.impl.PaymentPluginConfigModelImpl.ORDER_BY_SQL);
            }

            SQLQuery q = session.createSQLQuery(sql);

            q.addEntity("Payment_PaymentPluginConfig",
                    com.beorn.onlinepayment.model.impl.PaymentPluginConfigImpl.class);

            QueryPos qPos = QueryPos.getInstance(q);

            qPos.add(pk);

            list = (List<com.beorn.onlinepayment.model.PaymentPluginConfig>) QueryUtil.list(q, getDialect(),
                    start, end);
        } catch (Exception e) {
            throw processException(e);
        } finally {
            if (list == null) {
                FinderCacheUtil.removeResult(FINDER_PATH_GET_PAYMENTPLUGINCONFIGS, finderArgs);
            } else {
                paymentPluginConfigPersistence.cacheResult(list);

                FinderCacheUtil.putResult(FINDER_PATH_GET_PAYMENTPLUGINCONFIGS, finderArgs, list);
            }

            closeSession(session);
        }
    }

    return list;
}

From source file:com.beorn.onlinepayment.service.persistence.PaymentPluginPersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the payment methods associated with the payment plugin.
 *
 * <p>//from  w w  w  .  jav a2s  .  com
 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
 * </p>
 *
 * @param pk the primary key of the payment plugin
 * @param start the lower bound of the range of payment plugins
 * @param end the upper bound of the range of payment plugins (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of payment methods associated with the payment plugin
 * @throws SystemException if a system exception occurred
 */
public List<com.beorn.onlinepayment.model.PaymentMethod> getPaymentMethods(long pk, int start, int end,
        OrderByComparator orderByComparator) throws SystemException {
    Object[] finderArgs = new Object[] { pk, start, end, orderByComparator };

    List<com.beorn.onlinepayment.model.PaymentMethod> list = (List<com.beorn.onlinepayment.model.PaymentMethod>) FinderCacheUtil
            .getResult(FINDER_PATH_GET_PAYMENTMETHODS, finderArgs, this);

    if (list == null) {
        Session session = null;

        try {
            session = openSession();

            String sql = null;

            if (orderByComparator != null) {
                sql = _SQL_GETPAYMENTMETHODS.concat(ORDER_BY_CLAUSE).concat(orderByComparator.getOrderBy());
            } else {
                sql = _SQL_GETPAYMENTMETHODS
                        .concat(com.beorn.onlinepayment.model.impl.PaymentMethodModelImpl.ORDER_BY_SQL);
            }

            SQLQuery q = session.createSQLQuery(sql);

            q.addEntity("Payment_PaymentMethod", com.beorn.onlinepayment.model.impl.PaymentMethodImpl.class);

            QueryPos qPos = QueryPos.getInstance(q);

            qPos.add(pk);

            list = (List<com.beorn.onlinepayment.model.PaymentMethod>) QueryUtil.list(q, getDialect(), start,
                    end);
        } catch (Exception e) {
            throw processException(e);
        } finally {
            if (list == null) {
                FinderCacheUtil.removeResult(FINDER_PATH_GET_PAYMENTMETHODS, finderArgs);
            } else {
                paymentMethodPersistence.cacheResult(list);

                FinderCacheUtil.putResult(FINDER_PATH_GET_PAYMENTMETHODS, finderArgs, list);
            }

            closeSession(session);
        }
    }

    return list;
}

From source file:com.beorn.onlinepayment.service.persistence.SellerPersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the transactions associated with the seller.
 *
 * <p>/* ww  w  .j ava 2 s.  c om*/
 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
 * </p>
 *
 * @param pk the primary key of the seller
 * @param start the lower bound of the range of sellers
 * @param end the upper bound of the range of sellers (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of transactions associated with the seller
 * @throws SystemException if a system exception occurred
 */
public List<com.beorn.onlinepayment.model.Transaction> getTransactions(long pk, int start, int end,
        OrderByComparator orderByComparator) throws SystemException {
    Object[] finderArgs = new Object[] { pk, start, end, orderByComparator };

    List<com.beorn.onlinepayment.model.Transaction> list = (List<com.beorn.onlinepayment.model.Transaction>) FinderCacheUtil
            .getResult(FINDER_PATH_GET_TRANSACTIONS, finderArgs, this);

    if (list == null) {
        Session session = null;

        try {
            session = openSession();

            String sql = null;

            if (orderByComparator != null) {
                sql = _SQL_GETTRANSACTIONS.concat(ORDER_BY_CLAUSE).concat(orderByComparator.getOrderBy());
            } else {
                sql = _SQL_GETTRANSACTIONS
                        .concat(com.beorn.onlinepayment.model.impl.TransactionModelImpl.ORDER_BY_SQL);
            }

            SQLQuery q = session.createSQLQuery(sql);

            q.addEntity("Payment_Transaction", com.beorn.onlinepayment.model.impl.TransactionImpl.class);

            QueryPos qPos = QueryPos.getInstance(q);

            qPos.add(pk);

            list = (List<com.beorn.onlinepayment.model.Transaction>) QueryUtil.list(q, getDialect(), start,
                    end);
        } catch (Exception e) {
            throw processException(e);
        } finally {
            if (list == null) {
                FinderCacheUtil.removeResult(FINDER_PATH_GET_TRANSACTIONS, finderArgs);
            } else {
                transactionPersistence.cacheResult(list);

                FinderCacheUtil.putResult(FINDER_PATH_GET_TRANSACTIONS, finderArgs, list);
            }

            closeSession(session);
        }
    }

    return list;
}

From source file:com.beorn.onlinepayment.service.persistence.TransactionPersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the transaction logs associated with the transaction.
 *
 * <p>/*from ww  w.  j  av a  2  s. c o  m*/
 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
 * </p>
 *
 * @param pk the primary key of the transaction
 * @param start the lower bound of the range of transactions
 * @param end the upper bound of the range of transactions (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of transaction logs associated with the transaction
 * @throws SystemException if a system exception occurred
 */
public List<com.beorn.onlinepayment.model.TransactionLog> getTransactionLogs(long pk, int start, int end,
        OrderByComparator orderByComparator) throws SystemException {
    Object[] finderArgs = new Object[] { pk, start, end, orderByComparator };

    List<com.beorn.onlinepayment.model.TransactionLog> list = (List<com.beorn.onlinepayment.model.TransactionLog>) FinderCacheUtil
            .getResult(FINDER_PATH_GET_TRANSACTIONLOGS, finderArgs, this);

    if (list == null) {
        Session session = null;

        try {
            session = openSession();

            String sql = null;

            if (orderByComparator != null) {
                sql = _SQL_GETTRANSACTIONLOGS.concat(ORDER_BY_CLAUSE).concat(orderByComparator.getOrderBy());
            } else {
                sql = _SQL_GETTRANSACTIONLOGS
                        .concat(com.beorn.onlinepayment.model.impl.TransactionLogModelImpl.ORDER_BY_SQL);
            }

            SQLQuery q = session.createSQLQuery(sql);

            q.addEntity("Payment_TransactionLog", com.beorn.onlinepayment.model.impl.TransactionLogImpl.class);

            QueryPos qPos = QueryPos.getInstance(q);

            qPos.add(pk);

            list = (List<com.beorn.onlinepayment.model.TransactionLog>) QueryUtil.list(q, getDialect(), start,
                    end);
        } catch (Exception e) {
            throw processException(e);
        } finally {
            if (list == null) {
                FinderCacheUtil.removeResult(FINDER_PATH_GET_TRANSACTIONLOGS, finderArgs);
            } else {
                transactionLogPersistence.cacheResult(list);

                FinderCacheUtil.putResult(FINDER_PATH_GET_TRANSACTIONLOGS, finderArgs, list);
            }

            closeSession(session);
        }
    }

    return list;
}

From source file:com.beorn.onlinepayment.service.persistence.TransactionPersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the transaction parameters associated with the transaction.
 *
 * <p>//w w w .  j av a  2s .  c  o  m
 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
 * </p>
 *
 * @param pk the primary key of the transaction
 * @param start the lower bound of the range of transactions
 * @param end the upper bound of the range of transactions (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of transaction parameters associated with the transaction
 * @throws SystemException if a system exception occurred
 */
public List<com.beorn.onlinepayment.model.TransactionParameter> getTransactionParameters(long pk, int start,
        int end, OrderByComparator orderByComparator) throws SystemException {
    Object[] finderArgs = new Object[] { pk, start, end, orderByComparator };

    List<com.beorn.onlinepayment.model.TransactionParameter> list = (List<com.beorn.onlinepayment.model.TransactionParameter>) FinderCacheUtil
            .getResult(FINDER_PATH_GET_TRANSACTIONPARAMETERS, finderArgs, this);

    if (list == null) {
        Session session = null;

        try {
            session = openSession();

            String sql = null;

            if (orderByComparator != null) {
                sql = _SQL_GETTRANSACTIONPARAMETERS.concat(ORDER_BY_CLAUSE)
                        .concat(orderByComparator.getOrderBy());
            } else {
                sql = _SQL_GETTRANSACTIONPARAMETERS
                        .concat(com.beorn.onlinepayment.model.impl.TransactionParameterModelImpl.ORDER_BY_SQL);
            }

            SQLQuery q = session.createSQLQuery(sql);

            q.addEntity("Payment_TransactionParameter",
                    com.beorn.onlinepayment.model.impl.TransactionParameterImpl.class);

            QueryPos qPos = QueryPos.getInstance(q);

            qPos.add(pk);

            list = (List<com.beorn.onlinepayment.model.TransactionParameter>) QueryUtil.list(q, getDialect(),
                    start, end);
        } catch (Exception e) {
            throw processException(e);
        } finally {
            if (list == null) {
                FinderCacheUtil.removeResult(FINDER_PATH_GET_TRANSACTIONPARAMETERS, finderArgs);
            } else {
                transactionParameterPersistence.cacheResult(list);

                FinderCacheUtil.putResult(FINDER_PATH_GET_TRANSACTIONPARAMETERS, finderArgs, list);
            }

            closeSession(session);
        }
    }

    return list;
}

From source file:com.inkwell.internet.productregistration.service.persistence.PRUserPersistenceImpl.java

License:Open Source License

/**
 * Gets an ordered range of all the p r registrations associated with the p r user.
 *
 * <p>//from   ww w .  j  av a  2 s.  c o  m
 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
 * </p>
 *
 * @param pk the primary key of the p r user to get the associated p r registrations for
 * @param start the lower bound of the range of p r users to return
 * @param end the upper bound of the range of p r users to return (not inclusive)
 * @param orderByComparator the comparator to order the results by
 * @return the ordered range of p r registrations associated with the p r user
 * @throws SystemException if a system exception occurred
 */
public List<com.inkwell.internet.productregistration.model.PRRegistration> getPRRegistrations(long pk,
        int start, int end, OrderByComparator orderByComparator) throws SystemException {
    Object[] finderArgs = new Object[] { pk, String.valueOf(start), String.valueOf(end),
            String.valueOf(orderByComparator) };

    List<com.inkwell.internet.productregistration.model.PRRegistration> list = (List<com.inkwell.internet.productregistration.model.PRRegistration>) FinderCacheUtil
            .getResult(FINDER_PATH_GET_PRREGISTRATIONS, finderArgs, this);

    if (list == null) {
        Session session = null;

        try {
            session = openSession();

            String sql = null;

            if (orderByComparator != null) {
                sql = _SQL_GETPRREGISTRATIONS.concat(ORDER_BY_CLAUSE).concat(orderByComparator.getOrderBy());
            } else {
                sql = _SQL_GETPRREGISTRATIONS;
            }

            SQLQuery q = session.createSQLQuery(sql);

            q.addEntity("PR_PRRegistration",
                    com.inkwell.internet.productregistration.model.impl.PRRegistrationImpl.class);

            QueryPos qPos = QueryPos.getInstance(q);

            qPos.add(pk);

            list = (List<com.inkwell.internet.productregistration.model.PRRegistration>) QueryUtil.list(q,
                    getDialect(), start, end);
        } catch (Exception e) {
            throw processException(e);
        } finally {
            if (list == null) {
                FinderCacheUtil.removeResult(FINDER_PATH_GET_PRREGISTRATIONS, finderArgs);
            } else {
                prRegistrationPersistence.cacheResult(list);

                FinderCacheUtil.putResult(FINDER_PATH_GET_PRREGISTRATIONS, finderArgs, list);
            }

            closeSession(session);
        }
    }

    return list;
}

From source file:com.iucn.whp.dbservice.service.persistence.assessing_threats_currentPersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the current_threat_assessment_cats associated with the assessing_threats_current.
 *
 * <p>/*from  w w w  .j  a  va2s.c  om*/
 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
 * </p>
 *
 * @param pk the primary key of the assessing_threats_current
 * @param start the lower bound of the range of assessing_threats_currents
 * @param end the upper bound of the range of assessing_threats_currents (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of current_threat_assessment_cats associated with the assessing_threats_current
 * @throws SystemException if a system exception occurred
 */
public List<com.iucn.whp.dbservice.model.current_threat_assessment_cat> getcurrent_threat_assessment_cats(
        long pk, int start, int end, OrderByComparator orderByComparator) throws SystemException {
    Object[] finderArgs = new Object[] { pk, start, end, orderByComparator };

    List<com.iucn.whp.dbservice.model.current_threat_assessment_cat> list = (List<com.iucn.whp.dbservice.model.current_threat_assessment_cat>) FinderCacheUtil
            .getResult(FINDER_PATH_GET_CURRENT_THREAT_ASSESSMENT_CATS, finderArgs, this);

    if (list == null) {
        Session session = null;

        try {
            session = openSession();

            String sql = null;

            if (orderByComparator != null) {
                sql = _SQL_GETCURRENT_THREAT_ASSESSMENT_CATS.concat(ORDER_BY_CLAUSE)
                        .concat(orderByComparator.getOrderBy());
            } else {
                sql = _SQL_GETCURRENT_THREAT_ASSESSMENT_CATS;
            }

            SQLQuery q = session.createSQLQuery(sql);

            q.addEntity("whp_current_threat_assessment_cat",
                    com.iucn.whp.dbservice.model.impl.current_threat_assessment_catImpl.class);

            QueryPos qPos = QueryPos.getInstance(q);

            qPos.add(pk);

            list = (List<com.iucn.whp.dbservice.model.current_threat_assessment_cat>) QueryUtil.list(q,
                    getDialect(), start, end);
        } catch (Exception e) {
            throw processException(e);
        } finally {
            if (list == null) {
                FinderCacheUtil.removeResult(FINDER_PATH_GET_CURRENT_THREAT_ASSESSMENT_CATS, finderArgs);
            } else {
                current_threat_assessment_catPersistence.cacheResult(list);

                FinderCacheUtil.putResult(FINDER_PATH_GET_CURRENT_THREAT_ASSESSMENT_CATS, finderArgs, list);
            }

            closeSession(session);
        }
    }

    return list;
}

From source file:com.iucn.whp.dbservice.service.persistence.assessing_threats_currentPersistenceImpl.java

License:Open Source License

/**
 * Returns an ordered range of all the current_threat_valueses associated with the assessing_threats_current.
 *
 * <p>// w w w. jav a 2 s .com
 * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
 * </p>
 *
 * @param pk the primary key of the assessing_threats_current
 * @param start the lower bound of the range of assessing_threats_currents
 * @param end the upper bound of the range of assessing_threats_currents (not inclusive)
 * @param orderByComparator the comparator to order the results by (optionally <code>null</code>)
 * @return the ordered range of current_threat_valueses associated with the assessing_threats_current
 * @throws SystemException if a system exception occurred
 */
public List<com.iucn.whp.dbservice.model.current_threat_values> getcurrent_threat_valueses(long pk, int start,
        int end, OrderByComparator orderByComparator) throws SystemException {
    Object[] finderArgs = new Object[] { pk, start, end, orderByComparator };

    List<com.iucn.whp.dbservice.model.current_threat_values> list = (List<com.iucn.whp.dbservice.model.current_threat_values>) FinderCacheUtil
            .getResult(FINDER_PATH_GET_CURRENT_THREAT_VALUESES, finderArgs, this);

    if (list == null) {
        Session session = null;

        try {
            session = openSession();

            String sql = null;

            if (orderByComparator != null) {
                sql = _SQL_GETCURRENT_THREAT_VALUESES.concat(ORDER_BY_CLAUSE)
                        .concat(orderByComparator.getOrderBy());
            } else {
                sql = _SQL_GETCURRENT_THREAT_VALUESES;
            }

            SQLQuery q = session.createSQLQuery(sql);

            q.addEntity("whp_current_threat_values",
                    com.iucn.whp.dbservice.model.impl.current_threat_valuesImpl.class);

            QueryPos qPos = QueryPos.getInstance(q);

            qPos.add(pk);

            list = (List<com.iucn.whp.dbservice.model.current_threat_values>) QueryUtil.list(q, getDialect(),
                    start, end);
        } catch (Exception e) {
            throw processException(e);
        } finally {
            if (list == null) {
                FinderCacheUtil.removeResult(FINDER_PATH_GET_CURRENT_THREAT_VALUESES, finderArgs);
            } else {
                current_threat_valuesPersistence.cacheResult(list);

                FinderCacheUtil.putResult(FINDER_PATH_GET_CURRENT_THREAT_VALUESES, finderArgs, list);
            }

            closeSession(session);
        }
    }

    return list;
}