I have a very basic question about the features of Hibernate.
Suppose we have 2 entities, Teacher and Courses. and a relation TeacheS, so it is obvious that a Teacher teacheS one or more Courses.
Clearly this is a many to one relationship.
This would produce 3 tables in my database:
Teacher, Teaches, Courses
SO, when I ad a teacher, and a Course is Hibernate capable of AUTOMATICLY making the proper inserts in the Teaches Table ? (When typing this I think it sounds weard, but i don't know, maybe the mapping files can do this). Or is it me who has to write some java code for it.
In te latter case, then why the hell are the <many to one ... > clauses used in the mapping files ? as some sort of constraints ??
Thx for clearing this up for me...
|