Recently, I have been learning about Hibernate, and I am facing some difficulties. My first problem is as follows: I am very much confused with the below terms.
- Bidirectional mapping
- Many to One
Because, as far as I know, in rdbms we first need to insert in parent table. Then we can insert on child table, so the only possible scenario is one-to-many (first parent then children). Then, how is many-to-one is going to work? Second, what is this bidirectional mapping in regards to Hibernate. Specifically, different types of join annotations confuse me a lot. I am listing those annotations below.
1.@JoinTable(name = "Tbale_Name", joinColumns = { @JoinColumn(name = "Column_Name") },
inverseJoinColumns = { @JoinColumn(name = "Another_ColumnName") })
2.@OneToMany(mappedBy="department")` this mappedby term
3.@PrimaryKeyJoinColumn
Please help me understand these concepts.