Package com.finiac.dao

Source Code of com.finiac.dao.PartialPayementDAOImpl

package com.finiac.dao;

import java.util.List;

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

import com.finiac.model.PartialPayment;


public class PartialPayementDAOImpl implements PartialPaymentDAO {

 
  private HibernateTemplate hibernateTemplate;
 
  public void setSessionFactory(SessionFactory sessionFactory){
    this.hibernateTemplate = new HibernateTemplate(sessionFactory);
  }
 
 
  @Override
  public void addDetails(PartialPayment partialPayment) {
    hibernateTemplate.saveOrUpdate(partialPayment);

  }

  @SuppressWarnings("unchecked")
  @Override
  public List<PartialPayment> listAll() {
    return hibernateTemplate.find("from PartialPayment where isActive = 1 order by studentId");
  }


  @SuppressWarnings("unchecked")
  @Override
  public PartialPayment selectById(long id) {
    PartialPayment partialPay = new PartialPayment();
    List<PartialPayment> partialPayList= hibernateTemplate.find("from PartialPayment where id="+id +" and isActive =1");
    for(int i=0;i<partialPayList.size();i++)
    {
      partialPay = partialPayList.get(i);
    }
    return partialPay;
  }


  @Override
  public void deletePartialPay(long id) {
    PartialPayment partialPay = new PartialPayment();
    partialPay = this.selectById(id);
    partialPay.setIsActive(0);
    partialPay.setAmount(0);
    this.addDetails(partialPay);
   
  }


  @SuppressWarnings("unchecked")
  @Override
  public List<PartialPayment> selectByStudent(long studentId) {
    return hibernateTemplate.find("from PartialPayment where studentId ="+studentId+" and isActive=1");
  }

}
TOP

Related Classes of com.finiac.dao.PartialPayementDAOImpl

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.