hibernate的get方法发送了sql语句,但是没有查询结果

student表:
@Entity
@Table(name="student")
public class Student {
//学生表主键
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer id;

//学生选得所有课程
//单向N对N,建立一个新表student_course记录学生的选课情况
@ManyToMany(targetEntity=Course.class)
@Cascade(value = {org.hibernate.annotations.CascadeType.ALL})
@JoinTable(name="student_course",joinColumns=@JoinColumn(name="s_number",referencedColumnName="s_number"),inverseJoinColumns=@JoinColumn(name="c_number",referencedColumnName="c_number"))
private Set<Course> course = new HashSet<>() ;

//学生所属学院号
@ManyToOne(targetEntity=Department.class)
@JoinColumn(name="department",referencedColumnName="d_number",nullable=false)
@Cascade(value = {org.hibernate.annotations.CascadeType.ALL})
private Department department;
(其余省略)

}
department表:
@Entity
@Table(name="department")
public class Department {

@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
public Integer id;

//院系名称(非空)
@Column(nullable=false)
public String name;

//院系代号(唯一,非空)
@Column(nullable=false,unique=true)
public String d_number; 
(其余省略)

}
course表:
@Entity
@Table(name="course")
public class Course {
//课表主键
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer id;

//课程编号(非空,唯一)
@Column(nullable=false,unique=true)
private String c_number ;

//课程名称(唯一,非空)
@Column(nullable=false,unique=true)
private String name;

//课时(非空)课时_节
@Column(nullable=false)
private Integer period;

//学分(非空)
@Column(nullable=false)
private Integer credit;

//课程介绍
private String introduction;

}
BaseDao实现类:
@SuppressWarnings("unchecked")
public class BaseDao_impl implements BaseDao {

private Class clazz;

public  BaseDao_impl() {
    // TODO Auto-generated constructor stub
    ParameterizedType type= (ParameterizedType) this.getClass().getGenericSuperclass();
    //给泛型参数赋值
    clazz=(Class) type.getActualTypeArguments()[0];
}


//获取sessionfactory
private SessionFactory sessionFactory ;
//获取session
protected Session getSession(){
    return (Session) sessionFactory.getCurrentSession();
}

public SessionFactory getSessionFactory() {
    return sessionFactory;
}

public void setSessionFactory(SessionFactory sessionFactory) {
    this.sessionFactory = sessionFactory;
}


@Override
public T get(int id) {
    // TODO Auto-generated method stub
    return (T)getSession().get(clazz,id);
}

}
iunit测试类:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations="classpath:applicationContext_*.xml")
public class SSH_test {

@Resource
private StudentDao student_dao;

@Test
public void test_student_dao(){
    System.out.println(student_dao.get(1).getClass());
}

}

控制台信息:
Hibernate:
select
student0_.id as id1_3_0_,
student0_.ID_card as ID_card2_3_0_,
student0_.address as address3_3_0_,
student0_.class_number as class_nu4_3_0_,
student0_.department as departme9_3_0_,
student0_.name as name5_3_0_,
student0_.password as password6_3_0_,
student0_.phone as phone7_3_0_,
student0_.s_number as s_number8_3_0_,
department1_.id as id1_1_1_,
department1_.d_number as d_number2_1_1_,
department1_.name as name3_1_1_
from
student student0_
inner join
department department1_
on student0_.department=department1_.d_number
where
student0_.id=?
四月 25, 2017 11:56:05 上午 org.springframework.context.support.GenericApplicationContext doClose
信息: Closing org.springframework.context.support.GenericApplicationContext@34b7bfc0: startup date [Tue Apr 25 11:56:02 CST 2017]; root of context hierarchy

请问:发送了sql语句,但是没有get结果,而且junit也不通过,新手不懂怎么回事.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问