hibernate is object oriented query
Multiple students One teacher
entity class student, teacher
t_teacher table: t_id, name, age primary key t_id
t_student table: s_id, name, age primary key s_id
There is a reference to teacher in the student entity class of one side , and the foreign key s_tid is created using annotations;
there are students Xiaoming, Xiaoli, s_id is 1 and 2, and their corresponding database foreign key s_tid is 1, associated Teacher Lao Wang.
Then you only need to know any attribute of Lao Wang to query Xiaoming's information.
For example: from t_student where t_teacher.name = 'Pharaoh' returns an array of student objects List<student>
This array contains Xiaoming and Xiaoli Information