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

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


    }
  }

  protected void removeByCompanyId(String companyId)
    throws SystemException {
    Session session = null;

    try {
      session = openSession();

      StringBuffer query = new StringBuffer();
      query.append(
        "FROM Portlet IN CLASS com.liferay.portal.ejb.PortletHBM WHERE ");
      query.append("companyId = ?");
      query.append(" ");

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

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

      while (itr.hasNext()) {
        PortletHBM portletHBM = (PortletHBM)itr.next();
        PortletPool.remove((PortletPK)portletHBM.getPrimaryKey());
        session.delete(portletHBM);
      }

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


    }
  }

  protected void removeByG_C(String groupId, String companyId)
    throws SystemException {
    Session session = null;

    try {
      session = openSession();

      StringBuffer query = new StringBuffer();
      query.append(
        "FROM Portlet IN CLASS com.liferay.portal.ejb.PortletHBM WHERE ");
      query.append("groupId = ?");
      query.append(" AND ");
      query.append("companyId = ?");
      query.append(" ");

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

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

      while (itr.hasNext()) {
        PortletHBM portletHBM = (PortletHBM)itr.next();
        PortletPool.remove((PortletPK)portletHBM.getPrimaryKey());
        session.delete(portletHBM);
      }

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

      HibernateUtil.closeSession(session);
    }
  }

  protected int countByGroupId(String groupId) throws SystemException {
    Session session = null;

    try {
      session = openSession();

      StringBuffer query = new StringBuffer();
      query.append("SELECT COUNT(*) ");
      query.append(
        "FROM Portlet IN CLASS com.liferay.portal.ejb.PortletHBM WHERE ");
      query.append("groupId = ?");
      query.append(" ");

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

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

View Full Code Here

      HibernateUtil.closeSession(session);
    }
  }

  protected int countByCompanyId(String companyId) throws SystemException {
    Session session = null;

    try {
      session = openSession();

      StringBuffer query = new StringBuffer();
      query.append("SELECT COUNT(*) ");
      query.append(
        "FROM Portlet IN CLASS com.liferay.portal.ejb.PortletHBM WHERE ");
      query.append("companyId = ?");
      query.append(" ");

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

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

View Full Code Here

    }
  }

  protected int countByG_C(String groupId, String companyId)
    throws SystemException {
    Session session = null;

    try {
      session = openSession();

      StringBuffer query = new StringBuffer();
      query.append("SELECT COUNT(*) ");
      query.append(
        "FROM Portlet IN CLASS com.liferay.portal.ejb.PortletHBM WHERE ");
      query.append("groupId = ?");
      query.append(" AND ");
      query.append("companyId = ?");
      query.append(" ");

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

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

    return new com.liferay.portal.model.UserTracker(userTrackerId);
  }

  protected com.liferay.portal.model.UserTracker remove(String userTrackerId)
    throws NoSuchUserTrackerException, SystemException {
    Session session = null;

    try {
      session = openSession();

      UserTrackerHBM userTrackerHBM = (UserTrackerHBM)session.load(UserTrackerHBM.class,
          userTrackerId);
      com.liferay.portal.model.UserTracker userTracker = UserTrackerHBMUtil.model(userTrackerHBM);
      session.delete(userTrackerHBM);
      session.flush();
      UserTrackerPool.remove(userTrackerId);

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

  }

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

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

        if (userTracker.isNew()) {
          UserTrackerHBM userTrackerHBM = new UserTrackerHBM(userTracker.getUserTrackerId(),
              userTracker.getCompanyId(),
              userTracker.getUserId(),
              userTracker.getModifiedDate(),
              userTracker.getRemoteAddr(),
              userTracker.getRemoteHost(),
              userTracker.getUserAgent());
          session.save(userTrackerHBM);
          session.flush();
        }
        else {
          try {
            UserTrackerHBM userTrackerHBM = (UserTrackerHBM)session.load(UserTrackerHBM.class,
                userTracker.getPrimaryKey());
            userTrackerHBM.setCompanyId(userTracker.getCompanyId());
            userTrackerHBM.setUserId(userTracker.getUserId());
            userTrackerHBM.setModifiedDate(userTracker.getModifiedDate());
            userTrackerHBM.setRemoteAddr(userTracker.getRemoteAddr());
            userTrackerHBM.setRemoteHost(userTracker.getRemoteHost());
            userTrackerHBM.setUserAgent(userTracker.getUserAgent());
            session.flush();
          }
          catch (ObjectNotFoundException onfe) {
            UserTrackerHBM userTrackerHBM = new UserTrackerHBM(userTracker.getUserTrackerId(),
                userTracker.getCompanyId(),
                userTracker.getUserId(),
                userTracker.getModifiedDate(),
                userTracker.getRemoteAddr(),
                userTracker.getRemoteHost(),
                userTracker.getUserAgent());
            session.save(userTrackerHBM);
            session.flush();
          }
        }

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

  protected com.liferay.portal.model.UserTracker findByPrimaryKey(
    String userTrackerId)
    throws NoSuchUserTrackerException, SystemException {
    com.liferay.portal.model.UserTracker userTracker = UserTrackerPool.get(userTrackerId);
    Session session = null;

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

        UserTrackerHBM userTrackerHBM = (UserTrackerHBM)session.load(UserTrackerHBM.class,
            userTrackerId);
        userTracker = UserTrackerHBMUtil.model(userTrackerHBM);
      }

      return userTracker;
View Full Code Here

      HibernateUtil.closeSession(session);
    }
  }

  protected List findByCompanyId(String companyId) throws SystemException {
    Session session = null;

    try {
      session = openSession();

      StringBuffer query = new StringBuffer();
      query.append(
        "FROM UserTracker IN CLASS com.liferay.portal.ejb.UserTrackerHBM WHERE ");
      query.append("companyId = ?");
      query.append(" ");

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

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

    return findByCompanyId(companyId, begin, end, null);
  }

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

    try {
      session = openSession();

      StringBuffer query = new StringBuffer();
      query.append(
        "FROM UserTracker IN CLASS com.liferay.portal.ejb.UserTrackerHBM WHERE ");
      query.append("companyId = ?");
      query.append(" ");

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

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

      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.