Package org.springframework.orm.hibernate3

Examples of org.springframework.orm.hibernate3.HibernateTemplate.execute()


        }
    }
   
    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

  }
  public User findUserUsinglicense(final License l) {
    LOGGER.debug("findUserUsinglicense: " + l);
        HibernateTemplate t = new HibernateTemplate(getSessionFactory());
       
        List users = (List)t.execute(
                new HibernateCallback() {
                    public Object doInHibernate(Session s) throws HibernateException, SQLException {
                      Criteria criteria = s.createCriteria(UserImpl.class)
                      .add(Expression.eq("licenseUsed.id", new Long(l.getId())));
                        return criteria.list();
View Full Code Here

  }

  public List findLicenseInGroup(final long grpId) {
        HibernateTemplate t = new HibernateTemplate(getSessionFactory());
       
        return (List)t.execute(
                new HibernateCallback() {
                    public Object doInHibernate(Session s) throws HibernateException, SQLException {
                        return s.createCriteria(License.class)
                          .add(Expression.eq("group.id", new Long(grpId)))
                            .add(Expression.eq("enabled", Boolean.TRUE))
View Full Code Here

  }

  public List findLicenseWithoutGroupBuyedBy(final long id, final String type) {
        HibernateTemplate t = new HibernateTemplate(getSessionFactory());
       
        return (List)t.execute(
                new HibernateCallback() {
                    public Object doInHibernate(Session s) throws HibernateException, SQLException {
                      Criteria criteria = s.createCriteria(License.class)
                      .add(Expression.eq("buyer.id", new Long(id)))
                      .add(Expression.eq("enabled", Boolean.TRUE))
View Full Code Here

  }
 
  public List findLicenseBuyedBy(final long buyerId, final String type) {
        HibernateTemplate t = new HibernateTemplate(getSessionFactory());
       
        return (List)t.execute(
                new HibernateCallback() {
                    public Object doInHibernate(Session s) throws HibernateException, SQLException {
                      Criteria criteria = s.createCriteria(License.class)
                      .add(Expression.eq("enabled", Boolean.TRUE))
                      .add(Expression.eq("buyer.id", new Long(buyerId)));
View Full Code Here

    }
   
    public List findAll(final Class c) {
        HibernateTemplate t = new HibernateTemplate(this._sessionFactory);
       
        return (List)t.execute(
                new HibernateCallback() {
                    public Object doInHibernate(Session s) throws HibernateException, SQLException {
                        return s.createCriteria(c).list();
                    }
                }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.