如何使用hibernate过滤器在hibernate中过滤实体

时间:2017-01-24 06:35:08

标签: java hibernate hibernate-mapping hibernate-criteria hibernate-filters

我需要过滤对象列表中的实体,例如:

public class Student {

    private int id;

    private List<Course> courses;

}

public class Course {

    private int id;

    private String name;

    private float note;

    private Classroom classroom;

}

public class Classroom {

    private int id;

    private String classroom;

} 

如何获得一个学生对象,其中包含只有大于70的笔记的课程列表,并且位于教室23(例如)?

有没有办法使用实体的名称而不是数据库的列?

或者我如何将siber与hibernate为实体生成的别名相关联?

我附加了一个来自hibernate过滤器的链接: https://docs.jboss.org/hibernate/orm/5.0/manual/en-US/html/ch19.html

1 个答案:

答案 0 :(得分:1)

好吧,它认为这应该可以解决问题:

<强>实体

Display

查询前

str
相关问题