Package org.springframework.orm.hibernate3

Examples of org.springframework.orm.hibernate3.HibernateTemplate


                }
        );
  }
  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 HibernateLicenseDao(DaoHelper helper) {
        super(helper, License.class);
    }
   
  public boolean hasLicenseForHost(String hostId) {
    List list = new HibernateTemplate(getSessionFactory()).find("from "+ License.class.getName()+" l  where l.hostId = ? ", new Object[]{hostId});
    if(list != null && list.size()>0) {
      return true;
    }
    return false;
  }
View Full Code Here

    }
    return false;
  }

  public boolean hasTrialLicenseForHost(String hostId) {
    List list = new HibernateTemplate(getSessionFactory()).find("from "+ TrialLicense.class.getName()+" l  where l.hostId = ? ", new Object[]{hostId});
    if(list != null && list.size()>0) {
      return true;
    }
    return false;
  }
View Full Code Here

  public List findLicenseBuyedBy(final long buyerId) {
        return findLicenseBuyedBy(buyerId, null);
  }

  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 void setSessionFactory(SessionFactory sessionFactory) {
        _sessionFactory = sessionFactory;
    }
   
    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

                }
        );
    }
   
    public void doSave(final WOJObject o) throws DaoException {
        HibernateTemplate t = new HibernateTemplate(this._sessionFactory);
       
        t.execute(
                new HibernateCallback() {
                    public Object doInHibernate(Session s) throws HibernateException, SQLException {
                        s.saveOrUpdate(o);
                        return null;
                    }
View Full Code Here

                }
        );
    }
   
    public void doRemove(final WOJObject o) throws DaoException {
        HibernateTemplate t = new HibernateTemplate(this._sessionFactory);
       
        t.execute(
                new HibernateCallback() {
                    public Object doInHibernate(Session s) throws HibernateException, SQLException {
                        s.delete(o);
                        return null;
                    }
View Full Code Here

    public HibernatePaymentInfoDao(DaoHelper helper) {
        super(helper, PaymentInfo.class);
    }

    public PaymentInfo getPayment(Order pendingOrder) {
    HibernateTemplate t = new HibernateTemplate(getSessionFactory());
    List result = t.find("from "+ PaymentInfo.class.getName()+" pay  where pay.order = ? ", new Object[]{pendingOrder});
    if(result != null && result.size()>0) {
      return (PaymentInfo) result.get(0);
    }
    return null;
  }
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.