Package com.finiac.dao

Source Code of com.finiac.dao.StudentDAOImpl

package com.finiac.dao;

import java.util.List;

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



import com.finiac.model.Student;

public class StudentDAOImpl implements StudentDAO {

private HibernateTemplate hibernateTemplate;
 
  public void setSessionFactory(SessionFactory sessionFactory){
    this.hibernateTemplate = new HibernateTemplate(sessionFactory);
  }
 
  @SuppressWarnings("unchecked")
  @Override
  public Student selectByAdmissionNo(long admissionNo) {
    Student student= new Student();
    List<Student> studentList= hibernateTemplate.find("from Student where admissionNo="+admissionNo +" and isActive =1");
    for(int i=0;i<studentList.size();i++)
    {
      student = studentList.get(i);
    }
    return student;
  }
 
  @Override
  public void saveStudent(Student student) {
    hibernateTemplate.saveOrUpdate(student);

}

  @SuppressWarnings("unchecked")
  @Override
  public List<Student> listStudent() {
    return hibernateTemplate.find("from Student where isActive =1");
  }
 

}
TOP

Related Classes of com.finiac.dao.StudentDAOImpl

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.