Package org.springframework.orm.hibernate3

Examples of org.springframework.orm.hibernate3.HibernateTemplate


                    }
                }
        );
    }
    public User[] findUpdatedUsers(final Long since) {
        HibernateTemplate t = new HibernateTemplate(getSessionFactory());

        return (User[])t.execute(
                new HibernateCallback() {
                    public Object doInHibernate(Session s) throws HibernateException, SQLException {
                      LOGGER.debug("finding users updated since " + since);
                     
                      List foundUsers = s.createCriteria(User.class)
View Full Code Here


                    }
                }
        );
    }
    public User[] findUsersByRequest(final String request, final int from, final int size) {
        HibernateTemplate t = new HibernateTemplate(getSessionFactory());
       
        return (User[])t.execute(
                new HibernateCallback() {
                    public Object doInHibernate(Session s) throws HibernateException, SQLException {
                      LOGGER.debug("finding user between " + from + " and " + (from+size));
                      String reqToDo = request;
                      if (reqToDo.indexOf("from") == -1) {
View Full Code Here

    public HibernateProductDao(DaoHelper helper) {
        super(helper, Product.class);
    }

    public Product getProduct(String code) {
    HibernateTemplate t = new HibernateTemplate(getSessionFactory());
    List result = t.find("from "+ Product.class.getName()+"  product where product.code = ?", new Object[]{code});
    if(result != null && result.size()>0) {
      return (Product) result.get(0);
    }
    return null;
  }
View Full Code Here

                }
        );
    }

    public User[] findUsers(final int from, final int size) {
        HibernateTemplate t = new HibernateTemplate(getSessionFactory());
       
        return (User[])t.execute(
                new HibernateCallback() {
                    public Object doInHibernate(Session s) throws HibernateException, SQLException {
                      LOGGER.debug("finding user between " + from + " and " + (from+size));
                     
                      List foundUsers = s.createCriteria(UserImpl.class)
View Full Code Here

    }

    public void fetch(final WOJObject o) throws DaoException {
        if (o instanceof UserImpl) {
            final UserImpl u = (UserImpl)o;
            HibernateTemplate t = new HibernateTemplate(getSessionFactory());
            t.execute(
                    new HibernateCallback() {
                        public Object doInHibernate(Session s) throws HibernateException, SQLException {
                            s.lock(u, LockMode.NONE);
                            u.getBuyedLicenses().size();
                            return null;
View Full Code Here

            );
        }
    }
   
    public User findUserByEmail(final String email) {
        HibernateTemplate t = new HibernateTemplate(getSessionFactory());
        return (User)t.execute(
                new HibernateCallback() {
                    public Object doInHibernate(Session s) throws HibernateException, SQLException {
                      LOGGER.debug("finding user from email " + email);
                     
                      List foundUsers = s.createCriteria(User.class)
View Full Code Here

                    }
                }
        );
    }
  public User[] findEndLicenseOwner(final int dayFromCurrent) {
        HibernateTemplate t = new HibernateTemplate(getSessionFactory());
       
        return (User[])t.execute(
                new HibernateCallback() {
                    public Object doInHibernate(Session s) throws HibernateException, SQLException {
          long limitTime = TimeUtil.getGMTMillis() + TimeUtil.MILLISECONDS_A_DAY * dayFromCurrent;
                      LOGGER.debug("finding user whom licence expire before " + limitTime);
                     
View Full Code Here

                }
        );
  }

    public void delete(final Collection userIds) throws DaoException {
        HibernateTemplate t = new HibernateTemplate(getSessionFactory());
       
        t.execute(
            new HibernateCallback() {
                public Object doInHibernate(Session s) throws HibernateException, SQLException {
                    for (Iterator itIds = userIds.iterator(); itIds.hasNext();) {
                        Long id = (Long)itIds.next();
                        User u = (User)s.get(getHandledClass(), id);
View Full Code Here

            }
        );
    }

  public User[] findUsersInGroup(final Group group) {
        HibernateTemplate t = new HibernateTemplate(getSessionFactory());
        return (User[])t.execute(
                new HibernateCallback() {
                    public Object doInHibernate(Session s) throws HibernateException, SQLException {
                      LOGGER.debug("finding user in group " + group);
                     
                      List foundUsers = s.createCriteria(User.class)
View Full Code Here

                }
        );
  }

  public User[] findAdministratorsOfGroup(final Group group) {
        HibernateTemplate t = new HibernateTemplate(getSessionFactory());
       
        return (User[])t.execute(
                new HibernateCallback() {
                    public Object doInHibernate(Session s) throws HibernateException, SQLException {

                    List foundUsers = s.createQuery(
                "Select grp.administrators from Group as grp where grp.id=" + group.getId())
View Full Code Here

TOP

Related Classes of org.springframework.orm.hibernate3.HibernateTemplate

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.