Package com.wgc.dao

Source Code of com.wgc.dao.StudentDAO

package com.wgc.dao;

import java.util.List;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.wgc.beans.Student;

public class StudentDAO extends HibernateDaoSupport  {
    

   
    public void save(Student stu) {

      this.getHibernateTemplate().save(stu);
    }
   
  public void delete(Student stu) {

        this.getHibernateTemplate().delete(stu);
    }
   
    public Student findById(java.lang.String id) {

            Student stu = (Student)this.getHibernateTemplate().get("com.wgc.beans.Student", id);
            return stu;

    }
   
   
    @SuppressWarnings("unchecked")
  public List findByExample(Student stu) {
     
            List results = getHibernateTemplate().findByExample(stu);
            return results;
    }   
   
    @SuppressWarnings("unchecked")
  public List findByProperty(String propertyName, Object value) {

         String queryString = "from Student as model where model."
                     + propertyName + "= ?";
     return getHibernateTemplate().find(queryString, value);

  }

  @SuppressWarnings("unchecked")
  public List findByXm(Object xm
  ) {
    return findByProperty("xm", xm
    );
  }
 
  @SuppressWarnings("unchecked")
  public List findByXb(Object xb
  ) {
    return findByProperty("xb", xb
    );
  }
  @SuppressWarnings("unchecked")
  public List<Student> findByBjm(Object bjm) {
    return (List<Student>)this.findByProperty("bjm", bjm);
  }
 
  @SuppressWarnings("unchecked")
  public List findByCsny(Object csny
  ) {
    return findByProperty("csny", csny
    );
  }
 

  @SuppressWarnings("unchecked")
  public List findAll() {

      String queryString = "from BuildingInfo";
       return getHibernateTemplate().find(queryString);
  }
}
TOP

Related Classes of com.wgc.dao.StudentDAO

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.