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

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


  }

  protected com.liferay.portal.model.PortletPreferences remove(
    PortletPreferencesPK portletPreferencesPK)
    throws NoSuchPortletPreferencesException, SystemException {
    Session session = null;

    try {
      session = openSession();

      PortletPreferencesHBM portletPreferencesHBM = (PortletPreferencesHBM)session.load(PortletPreferencesHBM.class,
          portletPreferencesPK);
      com.liferay.portal.model.PortletPreferences portletPreferences = PortletPreferencesHBMUtil.model(portletPreferencesHBM);
      session.delete(portletPreferencesHBM);
      session.flush();
      PortletPreferencesPool.remove(portletPreferencesPK);

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


  }

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

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

        if (portletPreferences.isNew()) {
          PortletPreferencesHBM portletPreferencesHBM = new PortletPreferencesHBM(portletPreferences.getPortletId(),
              portletPreferences.getLayoutId(),
              portletPreferences.getUserId(),
              portletPreferences.getPreferences());
          session.save(portletPreferencesHBM);
          session.flush();
        }
        else {
          try {
            PortletPreferencesHBM portletPreferencesHBM = (PortletPreferencesHBM)session.load(PortletPreferencesHBM.class,
                portletPreferences.getPrimaryKey());
            portletPreferencesHBM.setPreferences(portletPreferences.getPreferences());
            session.flush();
          }
          catch (ObjectNotFoundException onfe) {
            PortletPreferencesHBM portletPreferencesHBM = new PortletPreferencesHBM(portletPreferences.getPortletId(),
                portletPreferences.getLayoutId(),
                portletPreferences.getUserId(),
                portletPreferences.getPreferences());
            session.save(portletPreferencesHBM);
            session.flush();
          }
        }

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

  protected com.liferay.portal.model.PortletPreferences findByPrimaryKey(
    PortletPreferencesPK portletPreferencesPK)
    throws NoSuchPortletPreferencesException, SystemException {
    com.liferay.portal.model.PortletPreferences portletPreferences = PortletPreferencesPool.get(portletPreferencesPK);
    Session session = null;

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

        PortletPreferencesHBM portletPreferencesHBM = (PortletPreferencesHBM)session.load(PortletPreferencesHBM.class,
            portletPreferencesPK);
        portletPreferences = PortletPreferencesHBMUtil.model(portletPreferencesHBM);
      }

      return portletPreferences;
View Full Code Here

      HibernateUtil.closeSession(session);
    }
  }

  protected List findByLayoutId(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();
      List list = new ArrayList();
View Full Code Here

    return findByLayoutId(layoutId, begin, end, null);
  }

  protected List findByLayoutId(String layoutId, 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(" ");

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

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

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

    PortletPreferencesPK portletPreferencesPK, String layoutId,
    OrderByComparator obc)
    throws NoSuchPortletPreferencesException, SystemException {
    com.liferay.portal.model.PortletPreferences portletPreferences = findByPrimaryKey(portletPreferencesPK);
    int count = countByLayoutId(layoutId);
    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(" ");

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

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

      com.liferay.portal.model.PortletPreferences[] array = new com.liferay.portal.model.PortletPreferences[3];
      ScrollableResults sr = q.scroll();
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 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();
      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 PortletPreferences IN CLASS com.liferay.portal.ejb.PortletPreferencesHBM WHERE ");
      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++, userId);

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

    PortletPreferencesPK portletPreferencesPK, String userId,
    OrderByComparator obc)
    throws NoSuchPortletPreferencesException, SystemException {
    com.liferay.portal.model.PortletPreferences portletPreferences = findByPrimaryKey(portletPreferencesPK);
    int count = countByUserId(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("userId = ?");
      query.append(" ");

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

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

      com.liferay.portal.model.PortletPreferences[] array = new com.liferay.portal.model.PortletPreferences[3];
      ScrollableResults sr = q.scroll();
View Full Code Here

    }
  }

  protected List findByL_U(String layoutId, 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("layoutId = ?");
      query.append(" AND ");
      query.append("userId = ?");
      query.append(" ");

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

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