Multiple choice technology web technology

Which of the following association needs tag element in mapping file?

  1. One to one

  2. One to many

  3. Many to one

  4. None of the above

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The element in Hibernate mapping is used for collections requiring key-value pair semantics, typically for one-to-many or many-to-many associations where the collection needs to be indexed. While , , and can also map one-to-many relationships, is specifically designed when you need to maintain index-based access to the collection elements.

AI explanation

In Hibernate mapping files, the element is used to map a Java `Map`-typed collection property, which is the standard way to represent a keyed one-to-many association (each key maps to one related child entity). One-to-one and many-to-one associations are instead mapped with and elements, which don't need the collection wrapper.