I have 2 tables.
Student (id,name,class_id)<br>
class(id,name)
student
relates to class
table through class_id
after using hibernate and generate into object, I'll have 2 objects
Student { int id; String name; Class class }
Class {int id; String name; Set<Student> student}
I want to save student information using hibernate (session.save(student)
). However, I have to call class through class_id
. Therefore, is there anyway to save the student without get the class object using hibernate?
This is just an example, I have work with a database that a table has many relationship with the others, and it's a pain for me.