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

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


  protected com.liferay.portal.model.PasswordTracker[] findByUserId_PrevAndNext(
    String passwordTrackerId, String userId, OrderByComparator obc)
    throws NoSuchPasswordTrackerException, SystemException {
    com.liferay.portal.model.PasswordTracker passwordTracker = findByPrimaryKey(passwordTrackerId);
    int count = countByUserId(userId);
    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);

      com.liferay.portal.model.PasswordTracker[] array = new com.liferay.portal.model.PasswordTracker[3];
      ScrollableResults sr = q.scroll();
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 PasswordTracker IN CLASS com.liferay.portal.ejb.PasswordTrackerHBM ");
      query.append("ORDER BY ");
      query.append("userId DESC").append(", ");
      query.append("createDate DESC");

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

      while (itr.hasNext()) {
        PasswordTrackerHBM passwordTrackerHBM = (PasswordTrackerHBM)itr.next();
        list.add(PasswordTrackerHBMUtil.model(passwordTrackerHBM));
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 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();

      while (itr.hasNext()) {
        PasswordTrackerHBM passwordTrackerHBM = (PasswordTrackerHBM)itr.next();
        PasswordTrackerPool.remove((String)passwordTrackerHBM.getPrimaryKey());
        session.delete(passwordTrackerHBM);
      }

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

    return new com.liferay.portal.model.Company(companyId);
  }

  protected com.liferay.portal.model.Company remove(String companyId)
    throws NoSuchCompanyException, SystemException {
    Session session = null;

    try {
      session = openSession();

      CompanyHBM companyHBM = (CompanyHBM)session.load(CompanyHBM.class,
          companyId);
      com.liferay.portal.model.Company company = CompanyHBMUtil.model(companyHBM);
      session.delete(companyHBM);
      session.flush();
      CompanyPool.remove(companyId);

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

    }
  }

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

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

        if (company.isNew()) {
          CompanyHBM companyHBM = new CompanyHBM(company.getCompanyId(),
              company.getKey(), company.getPortalURL(),
              company.getHomeURL(), company.getMx(),
              company.getName(), company.getShortName(),
              company.getType(), company.getSize(),
              company.getStreet(), company.getCity(),
              company.getState(), company.getZip(),
              company.getPhone(), company.getFax(),
              company.getEmailAddress(), company.getAuthType(),
              company.getAutoLogin(), company.getStrangers());
          session.save(companyHBM);
          session.flush();
        }
        else {
          try {
            CompanyHBM companyHBM = (CompanyHBM)session.load(CompanyHBM.class,
                company.getPrimaryKey());
            companyHBM.setKey(company.getKey());
            companyHBM.setPortalURL(company.getPortalURL());
            companyHBM.setHomeURL(company.getHomeURL());
            companyHBM.setMx(company.getMx());
            companyHBM.setName(company.getName());
            companyHBM.setShortName(company.getShortName());
            companyHBM.setType(company.getType());
            companyHBM.setSize(company.getSize());
            companyHBM.setStreet(company.getStreet());
            companyHBM.setCity(company.getCity());
            companyHBM.setState(company.getState());
            companyHBM.setZip(company.getZip());
            companyHBM.setPhone(company.getPhone());
            companyHBM.setFax(company.getFax());
            companyHBM.setEmailAddress(company.getEmailAddress());
            companyHBM.setAuthType(company.getAuthType());
            companyHBM.setAutoLogin(company.getAutoLogin());
            companyHBM.setStrangers(company.getStrangers());
            session.flush();
          }
          catch (ObjectNotFoundException onfe) {
            CompanyHBM companyHBM = new CompanyHBM(company.getCompanyId(),
                company.getKey(), company.getPortalURL(),
                company.getHomeURL(), company.getMx(),
                company.getName(), company.getShortName(),
                company.getType(), company.getSize(),
                company.getStreet(), company.getCity(),
                company.getState(), company.getZip(),
                company.getPhone(), company.getFax(),
                company.getEmailAddress(),
                company.getAuthType(), company.getAutoLogin(),
                company.getStrangers());
            session.save(companyHBM);
            session.flush();
          }
        }

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

  }

  protected com.liferay.portal.model.Company findByPrimaryKey(
    String companyId) throws NoSuchCompanyException, SystemException {
    com.liferay.portal.model.Company company = CompanyPool.get(companyId);
    Session session = null;

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

        CompanyHBM companyHBM = (CompanyHBM)session.load(CompanyHBM.class,
            companyId);
        company = CompanyHBMUtil.model(companyHBM);
      }

      return company;
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 Company IN CLASS com.liferay.portal.ejb.CompanyHBM ");

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

      while (itr.hasNext()) {
        CompanyHBM companyHBM = (CompanyHBM)itr.next();
        list.add(CompanyHBMUtil.model(companyHBM));
View Full Code Here

    return new com.liferay.portal.model.Image(imageId);
  }

  protected com.liferay.portal.model.Image remove(String imageId)
    throws NoSuchImageException, SystemException {
    Session session = null;

    try {
      session = openSession();

      ImageHBM imageHBM = (ImageHBM)session.load(ImageHBM.class, imageId);
      com.liferay.portal.model.Image image = ImageHBMUtil.model(imageHBM);
      session.delete(imageHBM);
      session.flush();
      ImagePool.remove(imageId);

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

    }
  }

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

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

        if (image.isNew()) {
          ImageHBM imageHBM = new ImageHBM(image.getImageId(),
              image.getText());
          session.save(imageHBM);
          session.flush();
        }
        else {
          try {
            ImageHBM imageHBM = (ImageHBM)session.load(ImageHBM.class,
                image.getPrimaryKey());
            imageHBM.setText(image.getText());
            session.flush();
          }
          catch (ObjectNotFoundException onfe) {
            ImageHBM imageHBM = new ImageHBM(image.getImageId(),
                image.getText());
            session.save(imageHBM);
            session.flush();
          }
        }

        image.setNew(false);
        image.setModified(false);
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.