Package com.dotcms.repackage.net.sf.hibernate

Examples of com.dotcms.repackage.net.sf.hibernate.Session


    return findByL_U(layoutId, userId, begin, end, null);
  }

  protected List findByL_U(String layoutId, String userId, int begin,
    int end, OrderByComparator obc) throws SystemException {
    Session session = null;

    try {
      session = openSession();

      StringBuffer query = new StringBuffer();
      query.append(
        "FROM PortletPreferences IN CLASS com.liferay.portal.ejb.PortletPreferencesHBM WHERE ");
      query.append("layoutId = ?");
      query.append(" AND ");
      query.append("userId = ?");
      query.append(" ");

      if (obc != null) {
        query.append("ORDER BY " + obc.getOrderBy());
      }

      Query q = session.createQuery(query.toString());
      int queryPos = 0;
      q.setString(queryPos++, layoutId);
      q.setString(queryPos++, userId);

      List list = new ArrayList();
View Full Code Here


    PortletPreferencesPK portletPreferencesPK, String layoutId,
    String userId, OrderByComparator obc)
    throws NoSuchPortletPreferencesException, SystemException {
    com.liferay.portal.model.PortletPreferences portletPreferences = findByPrimaryKey(portletPreferencesPK);
    int count = countByL_U(layoutId, userId);
    Session session = null;

    try {
      session = openSession();

      StringBuffer query = new StringBuffer();
      query.append(
        "FROM PortletPreferences IN CLASS com.liferay.portal.ejb.PortletPreferencesHBM WHERE ");
      query.append("layoutId = ?");
      query.append(" AND ");
      query.append("userId = ?");
      query.append(" ");

      if (obc != null) {
        query.append("ORDER BY " + obc.getOrderBy());
      }

      Query q = session.createQuery(query.toString());
      int queryPos = 0;
      q.setString(queryPos++, layoutId);
      q.setString(queryPos++, userId);

      com.liferay.portal.model.PortletPreferences[] array = new com.liferay.portal.model.PortletPreferences[3];
View Full Code Here

      HibernateUtil.closeSession(session);
    }
  }

  protected List findAll() throws SystemException {
    Session session = null;

    try {
      session = openSession();

      StringBuffer query = new StringBuffer();
      query.append(
        "FROM PortletPreferences IN CLASS com.liferay.portal.ejb.PortletPreferencesHBM ");

      Iterator itr = session.find(query.toString()).iterator();
      List list = new ArrayList();

      while (itr.hasNext()) {
        PortletPreferencesHBM portletPreferencesHBM = (PortletPreferencesHBM)itr.next();
        list.add(PortletPreferencesHBMUtil.model(portletPreferencesHBM));
View Full Code Here

      HibernateUtil.closeSession(session);
    }
  }

  protected void removeByLayoutId(String layoutId) throws SystemException {
    Session session = null;

    try {
      session = openSession();

      StringBuffer query = new StringBuffer();
      query.append(
        "FROM PortletPreferences IN CLASS com.liferay.portal.ejb.PortletPreferencesHBM WHERE ");
      query.append("layoutId = ?");
      query.append(" ");

      Query q = session.createQuery(query.toString());
      int queryPos = 0;
      q.setString(queryPos++, layoutId);

      Iterator itr = q.list().iterator();

      while (itr.hasNext()) {
        PortletPreferencesHBM portletPreferencesHBM = (PortletPreferencesHBM)itr.next();
        PortletPreferencesPool.remove((PortletPreferencesPK)portletPreferencesHBM.getPrimaryKey());
        session.delete(portletPreferencesHBM);
      }

      session.flush();
    }
    catch (HibernateException he) {
      throw new SystemException(he);
    }
    finally {
View Full Code Here

      HibernateUtil.closeSession(session);
    }
  }

  protected void removeByUserId(String userId) throws SystemException {
    Session session = null;

    try {
      session = openSession();

      StringBuffer query = new StringBuffer();
      query.append(
        "FROM PortletPreferences IN CLASS com.liferay.portal.ejb.PortletPreferencesHBM WHERE ");
      query.append("userId = ?");
      query.append(" ");

      Query q = session.createQuery(query.toString());
      int queryPos = 0;
      q.setString(queryPos++, userId);

      Iterator itr = q.list().iterator();

      while (itr.hasNext()) {
        PortletPreferencesHBM portletPreferencesHBM = (PortletPreferencesHBM)itr.next();
        PortletPreferencesPool.remove((PortletPreferencesPK)portletPreferencesHBM.getPrimaryKey());
        session.delete(portletPreferencesHBM);
      }

      session.flush();
    }
    catch (HibernateException he) {
      throw new SystemException(he);
    }
    finally {
View Full Code Here

  }

  protected com.liferay.portal.model.PasswordTracker remove(
    String passwordTrackerId)
    throws NoSuchPasswordTrackerException, SystemException {
    Session session = null;

    try {
      session = openSession();

      PasswordTrackerHBM passwordTrackerHBM = (PasswordTrackerHBM)session.load(PasswordTrackerHBM.class,
          passwordTrackerId);
      com.liferay.portal.model.PasswordTracker passwordTracker = PasswordTrackerHBMUtil.model(passwordTrackerHBM);
      session.delete(passwordTrackerHBM);
      session.flush();
      PasswordTrackerPool.remove(passwordTrackerId);

      return passwordTracker;
    }
    catch (HibernateException he) {
View Full Code Here

  }

  protected com.liferay.portal.model.PasswordTracker update(
    com.liferay.portal.model.PasswordTracker passwordTracker)
    throws SystemException {
    Session session = null;

    try {
      if (passwordTracker.isNew() || passwordTracker.isModified()) {
        session = openSession();

        if (passwordTracker.isNew()) {
          PasswordTrackerHBM passwordTrackerHBM = new PasswordTrackerHBM(passwordTracker.getPasswordTrackerId(),
              passwordTracker.getUserId(),
              passwordTracker.getCreateDate(),
              passwordTracker.getPassword());
          session.save(passwordTrackerHBM);
          session.flush();
        }
        else {
          try {
            PasswordTrackerHBM passwordTrackerHBM = (PasswordTrackerHBM)session.load(PasswordTrackerHBM.class,
                passwordTracker.getPrimaryKey());
            passwordTrackerHBM.setUserId(passwordTracker.getUserId());
            passwordTrackerHBM.setCreateDate(passwordTracker.getCreateDate());
            passwordTrackerHBM.setPassword(passwordTracker.getPassword());
            session.flush();
          }
          catch (ObjectNotFoundException onfe) {
            PasswordTrackerHBM passwordTrackerHBM = new PasswordTrackerHBM(passwordTracker.getPasswordTrackerId(),
                passwordTracker.getUserId(),
                passwordTracker.getCreateDate(),
                passwordTracker.getPassword());
            session.save(passwordTrackerHBM);
            session.flush();
          }
        }

        passwordTracker.setNew(false);
        passwordTracker.setModified(false);
View Full Code Here

  protected com.liferay.portal.model.PasswordTracker findByPrimaryKey(
    String passwordTrackerId)
    throws NoSuchPasswordTrackerException, SystemException {
    com.liferay.portal.model.PasswordTracker passwordTracker = PasswordTrackerPool.get(passwordTrackerId);
    Session session = null;

    try {
      if (passwordTracker == null) {
        session = openSession();

        PasswordTrackerHBM passwordTrackerHBM = (PasswordTrackerHBM)session.load(PasswordTrackerHBM.class,
            passwordTrackerId);
        passwordTracker = PasswordTrackerHBMUtil.model(passwordTrackerHBM);
      }

      return passwordTracker;
View Full Code Here

      HibernateUtil.closeSession(session);
    }
  }

  protected List findByUserId(String userId) throws SystemException {
    Session session = null;

    try {
      session = openSession();

      StringBuffer query = new StringBuffer();
      query.append(
        "FROM PasswordTracker IN CLASS com.liferay.portal.ejb.PasswordTrackerHBM WHERE ");
      query.append("userId = ?");
      query.append(" ");
      query.append("ORDER BY ");
      query.append("userId DESC").append(", ");
      query.append("createDate DESC");

      Query q = session.createQuery(query.toString());
      int queryPos = 0;
      q.setString(queryPos++, userId);

      Iterator itr = q.list().iterator();
      List list = new ArrayList();
View Full Code Here

    return findByUserId(userId, begin, end, null);
  }

  protected List findByUserId(String userId, int begin, int end,
    OrderByComparator obc) throws SystemException {
    Session session = null;

    try {
      session = openSession();

      StringBuffer query = new StringBuffer();
      query.append(
        "FROM PasswordTracker IN CLASS com.liferay.portal.ejb.PasswordTrackerHBM WHERE ");
      query.append("userId = ?");
      query.append(" ");

      if (obc != null) {
        query.append("ORDER BY " + obc.getOrderBy());
      }
      else {
        query.append("ORDER BY ");
        query.append("userId DESC").append(", ");
        query.append("createDate DESC");
      }

      Query q = session.createQuery(query.toString());
      int queryPos = 0;
      q.setString(queryPos++, userId);

      List list = new ArrayList();
View Full Code Here

TOP

Related Classes of com.dotcms.repackage.net.sf.hibernate.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.