Package com.finiac.dao

Source Code of com.finiac.dao.StockAlertSettingsDAOImpl

  package com.finiac.dao;

import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.orm.hibernate3.HibernateTemplate;

import com.finiac.model.StockAlertSettings;

public class StockAlertSettingsDAOImpl implements StockAlertSettingsDAO {

  private HibernateTemplate hibernateTemplate;
 
  public void setSessionFactory(SessionFactory sessionFactory){
    this.hibernateTemplate = new HibernateTemplate(sessionFactory);
  }

  @SuppressWarnings("unchecked")
  @Override
  public StockAlertSettings getSettings() {
    List<StockAlertSettings> settingsList=hibernateTemplate.find("from StockAlertSettings where variable='min_qty'");
    StockAlertSettings stockAlertSettings = new StockAlertSettings();
    for(int i=0;i<settingsList.size();i++)
    {
      stockAlertSettings = settingsList.get(i);
    }
    return stockAlertSettings;
  }

  @Override
  public void updateSettings(StockAlertSettings settings) {
    hibernateTemplate.update(settings);
   
  }

  @Override
  public void initStockAlert(StockAlertSettings settings) {
    hibernateTemplate.save(settings);
   
  }
 
}
TOP

Related Classes of com.finiac.dao.StockAlertSettingsDAOImpl

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.