Package com.liferay.portal.kernel.dao.orm

Examples of com.liferay.portal.kernel.dao.orm.Session


    List<WallEntry> list = (List<WallEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
        finderArgs, this);

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

      try {
        session = openSession();

        StringBundler query = null;
        String sql = null;

        if (orderByComparator != null) {
          query = new StringBundler(2 +
              (orderByComparator.getOrderByFields().length * 3));

          query.append(_SQL_SELECT_WALLENTRY);

          appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
            orderByComparator);

          sql = query.toString();
        }
        else {
          sql = _SQL_SELECT_WALLENTRY.concat(WallEntryModelImpl.ORDER_BY_JPQL);
        }

        Query q = session.createQuery(sql);

        if (orderByComparator == null) {
          list = (List<WallEntry>)QueryUtil.list(q, getDialect(),
              start, end, false);

View Full Code Here


    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
        finderArgs, this);

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

      try {
        session = openSession();

        StringBundler query = new StringBundler(2);

        query.append(_SQL_COUNT_WALLENTRY_WHERE);

        query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);

        String sql = query.toString();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(groupId);
View Full Code Here

    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
        finderArgs, this);

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

      try {
        session = openSession();

        StringBundler query = new StringBundler(2);

        query.append(_SQL_COUNT_WALLENTRY_WHERE);

        query.append(_FINDER_COLUMN_USERID_USERID_2);

        String sql = query.toString();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(userId);
View Full Code Here

    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U,
        finderArgs, this);

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

      try {
        session = openSession();

        StringBundler query = new StringBundler(3);

        query.append(_SQL_COUNT_WALLENTRY_WHERE);

        query.append(_FINDER_COLUMN_G_U_GROUPID_2);

        query.append(_FINDER_COLUMN_G_U_USERID_2);

        String sql = query.toString();

        Query q = session.createQuery(sql);

        QueryPos qPos = QueryPos.getInstance(q);

        qPos.add(groupId);
View Full Code Here

    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
        finderArgs, this);

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

      try {
        session = openSession();

        Query q = session.createQuery(_SQL_COUNT_WALLENTRY);

        count = (Long)q.uniqueResult();
      }
      catch (Exception e) {
        throw processException(e);
View Full Code Here

  public int countByG1_G2_U1_U2(
      long groupId1, long groupId2, long userId1, long userId2)
    throws SystemException {

    Session session = null;

    try {
      session = openSession();

      String sql = CustomSQLUtil.get(COUNT_BY_G1_G2_U1_U2);

      SQLQuery q = session.createSQLQuery(sql);

      q.addScalar(COUNT_COLUMN_NAME, Type.LONG);

      QueryPos qPos = QueryPos.getInstance(q);
View Full Code Here

  public List<WallEntry> findByG1_G2_U1_U2(
      long groupId1, long groupId2, long userId1, long userId2, int start,
      int end)
    throws SystemException {

    Session session = null;

    try {
      session = openSession();

      String sql = CustomSQLUtil.get(FIND_BY_G1_G2_U1_U2);

      SQLQuery q = session.createSQLQuery(sql);

      q.addEntity("SN_WallEntry", WallEntryImpl.class);

      QueryPos qPos = QueryPos.getInstance(q);
View Full Code Here

   * @throws com.liferay.socialnetworking.NoSuchMeetupsEntryException if a meetups entry with the primary key could not be found
   * @throws SystemException if a system exception occurred
   */
  public MeetupsEntry remove(long meetupsEntryId)
    throws NoSuchMeetupsEntryException, SystemException {
    Session session = null;

    try {
      session = openSession();

      MeetupsEntry meetupsEntry = (MeetupsEntry)session.get(MeetupsEntryImpl.class,
          new Long(meetupsEntryId));

      if (meetupsEntry == null) {
        if (_log.isWarnEnabled()) {
          _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
View Full Code Here

  protected MeetupsEntry removeImpl(MeetupsEntry meetupsEntry)
    throws SystemException {
    meetupsEntry = toUnwrappedModel(meetupsEntry);

    Session session = null;

    try {
      session = openSession();

      if (meetupsEntry.isCachedModel() || BatchSessionUtil.isEnabled()) {
        Object staleObject = session.get(MeetupsEntryImpl.class,
            meetupsEntry.getPrimaryKeyObj());

        if (staleObject != null) {
          session.evict(staleObject);
        }
      }

      session.delete(meetupsEntry);

      session.flush();
    }
    catch (Exception e) {
      throw processException(e);
    }
    finally {
View Full Code Here

  public MeetupsEntry updateImpl(
    com.liferay.socialnetworking.model.MeetupsEntry meetupsEntry,
    boolean merge) throws SystemException {
    meetupsEntry = toUnwrappedModel(meetupsEntry);

    Session session = null;

    try {
      session = openSession();

      BatchSessionUtil.update(session, meetupsEntry, merge);
View Full Code Here

TOP

Related Classes of com.liferay.portal.kernel.dao.orm.Session

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.