public Boolean addCfacontentFramework(CfacontentFramework c) {
   if (c != null) {
     super.getHibernateTemplate().save(c);
     return true;
   }
   return false;
 }
 /**
  * 修改一条数据
  *
  * @param CfacontentFramework
  * @return 成功(true)失败(false)
  */
 public Boolean updateCfacontentFrameworkById(CfacontentFramework c) {
   if (c != null) {
     super.getHibernateTemplate().update(c);
     return true;
   }
   return false;
 }
 /*
  * (non-Javadoc)
  *
  * @see
  * com.salesmanager.core.service.customer.impl.dao.ICustomerInfoDao#saveOrUpdate
  * (com.salesmanager.core.entity.customer.CustomerInfo)
  */
 public void saveOrUpdate(CustomerInfo instance) {
   try {
     super.getHibernateTemplate().saveOrUpdate(instance);
   } catch (RuntimeException re) {
     log.error("attach failed", re);
     throw re;
   }
 }
 /*
  * (non-Javadoc)
  *
  * @see
  * com.salesmanager.core.service.merchant.impl.IMerchantUserInformationDao
  * #delete(com.salesmanager.core.entity.merchant.MerchantUserInformation)
  */
 public void delete(MerchantUserInformation persistentInstance) {
   try {
     super.getHibernateTemplate().delete(persistentInstance);
   } catch (RuntimeException re) {
     log.error("delete failed", re);
     throw re;
   }
 }
 /*
  * (non-Javadoc)
  *
  * @see
  * com.salesmanager.core.service.tax.impl.IZoneToGeoZoneDao#persist(com.
  * salesmanager.core.entity.tax.ZoneToGeoZone)
  */
 public void persist(ZoneToGeoZone transientInstance) {
   try {
     super.getHibernateTemplate().persist(transientInstance);
   } catch (RuntimeException re) {
     log.error("persist failed", re);
     throw re;
   }
 }
 /*
  * (non-Javadoc)
  *
  * @seecom.salesmanager.core.service.tax.impl.IZoneToGeoZoneDao#delete(com.
  * salesmanager.core.entity.tax.ZoneToGeoZone)
  */
 public void delete(ZoneToGeoZone persistentInstance) {
   try {
     super.getHibernateTemplate().delete(persistentInstance);
   } catch (RuntimeException re) {
     log.error("delete failed", re);
     throw re;
   }
 }
 /*
  * (non-Javadoc)
  *
  * @see
  * com.salesmanager.core.service.merchant.impl.IMerchantUserInformationDao
  * #merge(com.salesmanager.core.entity.merchant.MerchantUserInformation)
  */
 public void saveOrUpdate(MerchantUserInformation instance) {
   try {
     super.getHibernateTemplate().saveOrUpdate(instance);
   } catch (RuntimeException re) {
     log.error("saveOrUpdate failed", re);
     throw re;
   }
 }
Esempio n. 8
0
  public void insert(String uid, Date date) {
    if (uid == null) throw new RuntimeException("uid must be set.");

    String dateStr = new SimpleDateFormat(ACCESSLOG_DATE_FORMAT).format(date);
    Accesslog entity = new Accesslog(null, uid, dateStr);

    super.getHibernateTemplate().save(entity);
  }
  /*
   * (non-Javadoc)
   *
   * @see
   * com.salesmanager.core.service.merchant.impl.IMerchantUserInformationDao
   * #persist(com.salesmanager.core.entity.merchant.MerchantUserInformation)
   */
  public void persist(MerchantUserInformation transientInstance) {

    try {
      super.getHibernateTemplate().persist(transientInstance);
    } catch (RuntimeException re) {
      log.error("persist failed", re);
      throw re;
    }
  }
  /*
   * (non-Javadoc)
   *
   * @see
   * com.salesmanager.core.service.tax.impl.IZoneToGeoZoneDao#deleteAll(java
   * .util.Collection)
   */
  public void deleteAll(Collection<ZoneToGeoZone> collection) {

    try {
      super.getHibernateTemplate().deleteAll(collection);
    } catch (RuntimeException re) {
      log.error("delete failed", re);
      throw re;
    }
  }
Esempio n. 11
0
 @SuppressWarnings("unchecked")
 private List<Guanzhu> getList(String sql, int page, int num) {
   List<Guanzhu> pList = new ArrayList<Guanzhu>();
   Query query = null;
   Session session = this.getHibernateTemplate().getSessionFactory().openSession();
   query = session.createQuery(sql);
   query.setFirstResult((page - 1) * num);
   query.setMaxResults(num);
   pList = query.list();
   super.releaseSession(session);
   session = null;
   return pList;
 }
 /**
  * 删除一条数据
  *
  * @param id主见
  * @return 成功(true)失败(false)
  */
 public Boolean deleteCfacontentFramework(Integer id) {
   try {
     String hql = "from CfacontentFramework where formworkId=?";
     Query query = this.getSession().createQuery(hql).setParameter(0, id);
     if (query.list().size() > 0) {
       CfacontentFramework c = (CfacontentFramework) query.list().get(0);
       super.getHibernateTemplate().delete(c);
       return true;
     }
     return false;
   } catch (Exception e) {
     e.printStackTrace();
   }
   return false;
 }
Esempio n. 13
0
 public void deleteOldLog() {
   Calendar currentDay = Calendar.getInstance();
   if (currentDay.get(Calendar.DAY_OF_YEAR) != logDeleteDay.get(Calendar.DAY_OF_YEAR)) {
     PropertiesDAO pdao = PropertiesDAO.newInstance();
     Properties property = pdao.findProperty("logStoragePeriod");
     int storagePeriod = 365;
     try {
       storagePeriod = Integer.parseInt(property.getValue());
     } catch (NumberFormatException ex) {
       log.error("Invalid logStoragePeriod property.", ex);
     }
     if (storagePeriod > 0) {
       Calendar deleteDate = Calendar.getInstance();
       deleteDate.add(Calendar.DATE, -(storagePeriod));
       String dateStr = new SimpleDateFormat(ACCESSLOG_DATE_FORMAT).format(deleteDate.getTime());
       String queryString = "delete Accesslog where Date < ?";
       super.getHibernateTemplate().bulkUpdate(queryString, dateStr);
     }
     logDeleteDay = currentDay;
   }
 }
  public void saveAccessToken(
      String tokenId,
      byte[] token,
      String authenticationId,
      String userId,
      String clientId,
      byte[] authentication,
      String refreshToken) {
    OAuth2ProviderAccessToken accessToken = getAccessTokenById(tokenId);

    if (accessToken == null) {
      accessToken = new OAuth2ProviderAccessToken(tokenId);
    }
    accessToken.setToken(token);
    accessToken.setAuthenticationId(authenticationId);
    accessToken.setUserId(userId);
    accessToken.setClientId(clientId);
    accessToken.setAuthentication(authentication);
    accessToken.setRefreshToken(refreshToken);
    super.getHibernateTemplate().saveOrUpdate(accessToken);
  }
Esempio n. 15
0
 // 为父类HibernateDaoSupport注入sessionFactory的值
 @Resource(name = "sessionFactory")
 public void baseSessionFactory(SessionFactory sessionFactory) {
   super.setSessionFactory(sessionFactory);
 }
 @Autowired
 public ZoneToGeoZoneDao(SessionFactory sessionFactory) {
   super.setSessionFactory(sessionFactory);
 }
Esempio n. 17
0
 @Autowired
 public CountryDao(SessionFactory sessionFactory) {
   super.setSessionFactory(sessionFactory);
 }
Esempio n. 18
0
 protected void initDao() throws Exception {
   super.initDao();
   log.info("initDao template " + getHibernateTemplate());
   hibernateTemplate = getHibernateTemplate();
 }
 @Autowired(required = true)
 public void setFactory(SessionFactory factory) {
   super.setSessionFactory(factory);
 }
 public void deleteRecord(Object obj) {
   super.getHibernateTemplate().delete(obj);
 }
 @Autowired
 public CustomerInfoDao(SessionFactory sessionFactory) {
   super.setSessionFactory(sessionFactory);
 }
 /** {@inheritDoc} */
 public void remove(PK id) {
   super.getHibernateTemplate().delete(this.get(id));
 }
 @Override
 public void update(T entity) {
   super.getHibernateTemplate().update(entity);
 }
Esempio n. 24
0
 @Inject
 public void setSuperSessionFactory(SessionFactory sessionFactory) {
   super.setSessionFactory(sessionFactory);
 }
Esempio n. 25
0
 @Autowired
 public SelectionDAO(SessionFactory sessionFactory) {
   super.setSessionFactory(sessionFactory);
 }
 public void add(TransferApp transferApp) {
   super.getHibernateTemplate().save(transferApp);
 }
 public void updateRecord(Object obj) {
   // TODO Auto-generated method stub
   super.getHibernateTemplate().update(obj);
 }
 public void editTransferApp(TransferApp transferApp) {
   super.getHibernateTemplate().update(transferApp); // 修改
 }
Esempio n. 29
0
 @Autowired
 public void setSessionFactoryOverride(SessionFactory sessionFactory) {
   super.setSessionFactory(sessionFactory);
 }
 @Override
 public void delete(Serializable... entityids) {
   for (Object id : entityids) {
     super.getHibernateTemplate().delete(findById((Serializable) id));
   }
 }