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

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


    }
  }

  protected void removeByC_C(String companyId, String className)
    throws SystemException {
    Session session = null;

    try {
      session = openSession();

      StringBuffer query = new StringBuffer();
      query.append(
        "FROM Address IN CLASS com.liferay.portal.ejb.AddressHBM WHERE ");
      query.append("companyId = ?");
      query.append(" AND ");
      query.append("className = ?");
      query.append(" ");
      query.append("ORDER BY ");
      query.append("companyId ASC").append(", ");
      query.append("className ASC").append(", ");
      query.append("classPK ASC").append(", ");
      query.append("priority ASC");

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

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

      while (itr.hasNext()) {
        AddressHBM addressHBM = (AddressHBM)itr.next();
        AddressPool.remove((String)addressHBM.getPrimaryKey());
        session.delete(addressHBM);
      }

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


    }
  }

  protected void removeByC_C_C(String companyId, String className,
    String classPK) throws SystemException {
    Session session = null;

    try {
      session = openSession();

      StringBuffer query = new StringBuffer();
      query.append(
        "FROM Address IN CLASS com.liferay.portal.ejb.AddressHBM WHERE ");
      query.append("companyId = ?");
      query.append(" AND ");
      query.append("className = ?");
      query.append(" AND ");
      query.append("classPK = ?");
      query.append(" ");
      query.append("ORDER BY ");
      query.append("companyId ASC").append(", ");
      query.append("className ASC").append(", ");
      query.append("classPK ASC").append(", ");
      query.append("priority ASC");

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

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

      while (itr.hasNext()) {
        AddressHBM addressHBM = (AddressHBM)itr.next();
        AddressPool.remove((String)addressHBM.getPrimaryKey());
        session.delete(addressHBM);
      }

      session.flush();
    }
    catch (HibernateException he) {
      throw new SystemException(he);
    }
    finally {
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 Address IN CLASS com.liferay.portal.ejb.AddressHBM 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

      HibernateUtil.closeSession(session);
    }
  }

  protected int countByUserId(String userId) throws SystemException {
    Session session = null;

    try {
      session = openSession();

      StringBuffer query = new StringBuffer();
      query.append("SELECT COUNT(*) ");
      query.append(
        "FROM Address IN CLASS com.liferay.portal.ejb.AddressHBM WHERE ");
      query.append("userId = ?");
      query.append(" ");

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

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

View Full Code Here

    }
  }

  protected int countByC_C(String companyId, String className)
    throws SystemException {
    Session session = null;

    try {
      session = openSession();

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

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

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

    }
  }

  protected int countByC_C_C(String companyId, String className,
    String classPK) throws SystemException {
    Session session = null;

    try {
      session = openSession();

      StringBuffer query = new StringBuffer();
      query.append("SELECT COUNT(*) ");
      query.append(
        "FROM Address IN CLASS com.liferay.portal.ejb.AddressHBM WHERE ");
      query.append("companyId = ?");
      query.append(" AND ");
      query.append("className = ?");
      query.append(" AND ");
      query.append("classPK = ?");
      query.append(" ");

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

View Full Code Here

    return new com.liferay.portal.model.Portlet(portletPK);
  }

  protected com.liferay.portal.model.Portlet remove(PortletPK portletPK)
    throws NoSuchPortletException, SystemException {
    Session session = null;

    try {
      session = openSession();

      PortletHBM portletHBM = (PortletHBM)session.load(PortletHBM.class,
          portletPK);
      com.liferay.portal.model.Portlet portlet = PortletHBMUtil.model(portletHBM);
      session.delete(portletHBM);
      session.flush();
      PortletPool.remove(portletPK);

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

    }
  }

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

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

        if (portlet.isNew()) {
          PortletHBM portletHBM = new PortletHBM(portlet.getPortletId(),
              portlet.getGroupId(), portlet.getCompanyId(),
              portlet.getDefaultPreferences(),
              portlet.getNarrow(), portlet.getRoles(),
              portlet.getActive());
          session.save(portletHBM);
          session.flush();
        }
        else {
          try {
            PortletHBM portletHBM = (PortletHBM)session.load(PortletHBM.class,
                portlet.getPrimaryKey());
            portletHBM.setDefaultPreferences(portlet.getDefaultPreferences());
            portletHBM.setNarrow(portlet.getNarrow());
            portletHBM.setRoles(portlet.getRoles());
            portletHBM.setActive(portlet.getActive());
            session.flush();
          }
          catch (ObjectNotFoundException onfe) {
            PortletHBM portletHBM = new PortletHBM(portlet.getPortletId(),
                portlet.getGroupId(), portlet.getCompanyId(),
                portlet.getDefaultPreferences(),
                portlet.getNarrow(), portlet.getRoles(),
                portlet.getActive());
            session.save(portletHBM);
            session.flush();
          }
        }

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

  }

  protected com.liferay.portal.model.Portlet findByPrimaryKey(
    PortletPK portletPK) throws NoSuchPortletException, SystemException {
    com.liferay.portal.model.Portlet portlet = PortletPool.get(portletPK);
    Session session = null;

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

        PortletHBM portletHBM = (PortletHBM)session.load(PortletHBM.class,
            portletPK);
        portlet = PortletHBMUtil.model(portletHBM);
      }

      return portlet;
View Full Code Here

      HibernateUtil.closeSession(session);
    }
  }

  protected List findByGroupId(String groupId) 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(" ");

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

      Iterator itr = q.list().iterator();
      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.