package cn.internship.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate4.support.HibernateDaoSupport;

import cn.internship.dao.InternshipDetailDao;
import cn.internship.entity.InternshipDetail;
public class InternshipDetailDaoImpl extends HibernateDaoSupport implements InternshipDetailDao{

	//根据学生学号获取实习信息
	@Override
	public InternshipDetail get(String sno) {
		String hql="from InternshipDetail it where it.sno=?";
		Object[] values={sno};
		List<InternshipDetail> it=(List<InternshipDetail>) getHibernateTemplate().find(hql, values);
		System.out.println(it.get(0));
		return it.get(0);
	}

}

package cn.internship.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate4.support.HibernateDaoSupport;

import cn.internship.dao.InternshipDetailDao;
import cn.internship.entity.InternshipDetail;
public class InternshipDetailDaoImpl extends HibernateDaoSupport implements InternshipDetailDao{

	//根据学生学号获取实习信息
	@Override
	public InternshipDetail get(String sno) {
		String hql="from InternshipDetail it where it.sno=?";
		Object[] values={sno};
		List<InternshipDetail> it=(List<InternshipDetail>) getHibernateTemplate().find(hql, values);
		
		if(it.get(0)==null){
			InternshipDetail intd=new InternshipDetail();
			intd.setSno(sno);
			intd.setCompany_address("尚未实习");
			intd.setCompany_name("尚未实习");
			intd.setCompany_teacher("尚未实习");
			intd.setDate(null);
			intd.setScore(null);
			return intd;
		}else{
			System.out.println(it.get(0));
			return it.get(0);
		}
		
		
	}

}

修改了InternshipDetailDaoImpl.java