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

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


  }

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

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

        ImageHBM imageHBM = (ImageHBM)session.load(ImageHBM.class,
            imageId);
        image = ImageHBMUtil.model(imageHBM);
      }

      return image;
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 Image IN CLASS com.liferay.portal.ejb.ImageHBM ");
      query.append("ORDER BY ");
      query.append("imageId ASC");

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

      while (itr.hasNext()) {
        ImageHBM imageHBM = (ImageHBM)itr.next();
        list.add(ImageHBMUtil.model(imageHBM));
View Full Code Here

    return new com.liferay.portal.model.Address(addressId);
  }

  protected com.liferay.portal.model.Address remove(String addressId)
    throws NoSuchAddressException, SystemException {
    Session session = null;

    try {
      session = openSession();

      AddressHBM addressHBM = (AddressHBM)session.load(AddressHBM.class,
          addressId);
      com.liferay.portal.model.Address address = AddressHBMUtil.model(addressHBM);
      session.delete(addressHBM);
      session.flush();
      AddressPool.remove(addressId);

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

    }
  }

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

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

        if (address.isNew()) {
          AddressHBM addressHBM = new AddressHBM(address.getAddressId(),
              address.getCompanyId(), address.getUserId(),
              address.getUserName(), address.getCreateDate(),
              address.getModifiedDate(), address.getClassName(),
              address.getClassPK(), address.getDescription(),
              address.getStreet1(), address.getStreet2(),
              address.getCity(), address.getState(),
              address.getZip(), address.getCountry(),
              address.getPhone(), address.getFax(),
              address.getCell(), address.getPriority());
          session.save(addressHBM);
          session.flush();
        }
        else {
          try {
            AddressHBM addressHBM = (AddressHBM)session.load(AddressHBM.class,
                address.getPrimaryKey());
            addressHBM.setCompanyId(address.getCompanyId());
            addressHBM.setUserId(address.getUserId());
            addressHBM.setUserName(address.getUserName());
            addressHBM.setCreateDate(address.getCreateDate());
            addressHBM.setModifiedDate(address.getModifiedDate());
            addressHBM.setClassName(address.getClassName());
            addressHBM.setClassPK(address.getClassPK());
            addressHBM.setDescription(address.getDescription());
            addressHBM.setStreet1(address.getStreet1());
            addressHBM.setStreet2(address.getStreet2());
            addressHBM.setCity(address.getCity());
            addressHBM.setState(address.getState());
            addressHBM.setZip(address.getZip());
            addressHBM.setCountry(address.getCountry());
            addressHBM.setPhone(address.getPhone());
            addressHBM.setFax(address.getFax());
            addressHBM.setCell(address.getCell());
            addressHBM.setPriority(address.getPriority());
            session.flush();
          }
          catch (ObjectNotFoundException onfe) {
            AddressHBM addressHBM = new AddressHBM(address.getAddressId(),
                address.getCompanyId(), address.getUserId(),
                address.getUserName(), address.getCreateDate(),
                address.getModifiedDate(),
                address.getClassName(), address.getClassPK(),
                address.getDescription(), address.getStreet1(),
                address.getStreet2(), address.getCity(),
                address.getState(), address.getZip(),
                address.getCountry(), address.getPhone(),
                address.getFax(), address.getCell(),
                address.getPriority());
            session.save(addressHBM);
            session.flush();
          }
        }

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

  }

  protected com.liferay.portal.model.Address findByPrimaryKey(
    String addressId) throws NoSuchAddressException, SystemException {
    com.liferay.portal.model.Address address = AddressPool.get(addressId);
    Session session = null;

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

        AddressHBM addressHBM = (AddressHBM)session.load(AddressHBM.class,
            addressId);
        address = AddressHBMUtil.model(addressHBM);
      }

      return address;
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 Address IN CLASS com.liferay.portal.ejb.AddressHBM WHERE ");
      query.append("companyId = ?");
      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);

      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 Address IN CLASS com.liferay.portal.ejb.AddressHBM WHERE ");
      query.append("companyId = ?");
      query.append(" ");

      if (obc != null) {
        query.append("ORDER BY " + obc.getOrderBy());
      }
      else {
        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);

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

  protected com.liferay.portal.model.Address[] findByCompanyId_PrevAndNext(
    String addressId, String companyId, OrderByComparator obc)
    throws NoSuchAddressException, SystemException {
    com.liferay.portal.model.Address address = findByPrimaryKey(addressId);
    int count = countByCompanyId(companyId);
    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(" ");

      if (obc != null) {
        query.append("ORDER BY " + obc.getOrderBy());
      }
      else {
        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);

      com.liferay.portal.model.Address[] array = new com.liferay.portal.model.Address[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 Address IN CLASS com.liferay.portal.ejb.AddressHBM WHERE ");
      query.append("userId = ?");
      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++, 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 Address IN CLASS com.liferay.portal.ejb.AddressHBM WHERE ");
      query.append("userId = ?");
      query.append(" ");

      if (obc != null) {
        query.append("ORDER BY " + obc.getOrderBy());
      }
      else {
        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++, 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.