Example usage for com.liferay.portal.kernel.dao.orm SQLQuery list

List of usage examples for com.liferay.portal.kernel.dao.orm SQLQuery list

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.dao.orm SQLQuery list.

Prototype

@SuppressWarnings("rawtypes")
    public List list(boolean unmodifiable) throws ORMException;

Source Link

Usage

From source file:com.liferay.blogs.service.persistence.impl.BlogsEntryFinderImpl.java

License:Open Source License

@Override
public List<BlogsEntry> findByNoAssets() {
    Session session = null;/*from  w  w  w. ja v  a 2  s .c  o m*/

    try {
        session = openSession();

        String sql = CustomSQLUtil.get(getClass(), FIND_BY_NO_ASSETS);

        SQLQuery q = session.createSynchronizedSQLQuery(sql);

        q.addEntity("BlogsEntry", BlogsEntryImpl.class);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(PortalUtil.getClassNameId(BlogsEntry.class));

        return q.list(true);
    } catch (Exception e) {
        throw new SystemException(e);
    } finally {
        closeSession(session);
    }
}

From source file:com.liferay.bookmarks.service.persistence.impl.BookmarksEntryFinderImpl.java

License:Open Source License

@Override
public List<BookmarksEntry> findByNoAssets() {
    Session session = null;// www .ja va  2s . c om

    try {
        session = openSession();

        String sql = CustomSQLUtil.get(getClass(), FIND_BY_NO_ASSETS);

        SQLQuery q = session.createSynchronizedSQLQuery(sql);

        q.addEntity("BookmarksEntry", BookmarksEntryImpl.class);

        return q.list(true);
    } catch (Exception e) {
        throw new SystemException(e);
    } finally {
        closeSession(session);
    }
}

From source file:com.liferay.bookmarks.service.persistence.impl.BookmarksFolderFinderImpl.java

License:Open Source License

@Override
public List<BookmarksFolder> findByNoAssets() {
    Session session = null;/*from   www . j  a v a 2s  .  com*/

    try {
        session = openSession();

        String sql = CustomSQLUtil.get(getClass(), FIND_BY_NO_ASSETS);

        SQLQuery q = session.createSynchronizedSQLQuery(sql);

        q.addEntity("BookmarksFolder", BookmarksFolderImpl.class);

        return q.list(true);
    } catch (Exception e) {
        throw new SystemException(e);
    } finally {
        closeSession(session);
    }
}

From source file:com.liferay.calendar.service.persistence.CalendarBookingFinderImpl.java

License:Open Source License

public List<CalendarBooking> findByFutureReminders(long startTime) throws SystemException {

    Session session = null;/*from  w  w  w .  j a v  a 2  s.c  om*/

    try {
        session = openSession();

        String sql = CustomSQLUtil.get(FIND_BY_FUTURE_REMINDERS);

        SQLQuery q = session.createSQLQuery(sql);

        q.addEntity("CalendarBooking", CalendarBookingImpl.class);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(startTime);

        return q.list(true);
    } catch (Exception e) {
        throw new SystemException(e);
    } finally {
        closeSession(session);
    }
}

From source file:com.liferay.calendar.service.persistence.impl.CalendarBookingFinderImpl.java

License:Open Source License

@Override
public List<CalendarBooking> findByFutureReminders(long startTime) {
    Session session = null;/* w ww.jav a2s  .  com*/

    try {
        session = openSession();

        String sql = CustomSQLUtil.get(FIND_BY_FUTURE_REMINDERS);

        SQLQuery q = session.createSynchronizedSQLQuery(sql);

        q.addEntity("CalendarBooking", CalendarBookingImpl.class);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(startTime);

        return q.list(true);
    } catch (Exception e) {
        throw new SystemException(e);
    } finally {
        closeSession(session);
    }
}

From source file:com.liferay.customsql.user.UserFinder.java

License:Open Source License

public List<User> findByNoContacts() throws SystemException {
    Session session = null;/*from  w  ww . j av  a2 s  .  c  om*/

    try {
        session = openSession();

        String sql = CustomSQLUtil.get(FIND_BY_NO_CONTACTS);

        SQLQuery q = session.createSynchronizedSQLQuery(sql);

        q.addEntity("User_", _userImplClass);

        return q.list(true);
    } catch (Exception e) {
        throw new SystemException(e);
    } finally {
        closeSession(session);
    }
}

From source file:com.liferay.document.library.file.rank.service.persistence.impl.DLFileRankFinderImpl.java

License:Open Source License

@Override
public List<Object[]> findByStaleRanks(int count) {
    Session session = null;/* ww  w .ja va 2 s  . c o m*/

    try {
        session = openSession();

        String sql = CustomSQLUtil.get(getClass(), FIND_BY_STALE_RANKS);

        SQLQuery q = session.createSynchronizedSQLQuery(sql);

        q.addScalar("groupId", Type.LONG);
        q.addScalar("userId", Type.LONG);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(count);

        return q.list(true);
    } catch (Exception e) {
        throw new SystemException(e);
    } finally {
        closeSession(session);
    }
}

From source file:com.liferay.document.library.file.rank.service.persistence.impl.DLFileRankFinderImpl.java

License:Open Source License

@Override
public List<DLFileRank> findByFolderId(long folderId) {
    Session session = null;//w  w w  . j av  a 2 s  .co m

    try {
        session = openSession();

        String sql = CustomSQLUtil.get(getClass(), FIND_BY_FOLDER_ID);

        SQLQuery q = session.createSynchronizedSQLQuery(sql);

        q.addEntity("DLFileRank", DLFileRankImpl.class);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(folderId);

        return q.list(true);
    } catch (Exception e) {
        throw new SystemException(e);
    } finally {
        closeSession(session);
    }
}

From source file:com.liferay.journal.service.persistence.impl.JournalArticleFinderImpl.java

License:Open Source License

@Override
public List<JournalArticle> findByExpirationDate(long classNameId, Date expirationDateLT,
        QueryDefinition<JournalArticle> queryDefinition) {

    Timestamp expirationDateLT_TS = CalendarUtil.getTimestamp(expirationDateLT);

    Session session = null;/*from w  w  w .  java  2s  . c o m*/

    try {
        session = openSession();

        String sql = CustomSQLUtil.get(getClass(), FIND_BY_EXPIRATION_DATE, queryDefinition);

        SQLQuery q = session.createSynchronizedSQLQuery(sql);

        q.addEntity(JournalArticleImpl.TABLE_NAME, JournalArticleImpl.class);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(classNameId);
        qPos.add(queryDefinition.getStatus());
        qPos.add(expirationDateLT_TS);

        return q.list(true);
    } catch (Exception e) {
        throw new SystemException(e);
    } finally {
        closeSession(session);
    }
}

From source file:com.liferay.journal.service.persistence.impl.JournalArticleFinderImpl.java

License:Open Source License

@Override
public List<JournalArticle> findByNoAssets() {
    Session session = null;/*  www.j  a  v a2  s  . c o m*/

    try {
        session = openSession();

        String sql = CustomSQLUtil.get(getClass(), FIND_BY_NO_ASSETS);

        SQLQuery q = session.createSynchronizedSQLQuery(sql);

        q.addEntity("JournalArticle", JournalArticleImpl.class);

        return q.list(true);
    } catch (Exception e) {
        throw new SystemException(e);
    } finally {
        closeSession(session);
    }
}