If a variable is an entity or class with a collection of values, we may use Java's collection interfaces to map those values.
Hibernate mappings are one of Java's most important features. As attributes in your model, they create the link between two database tables, making it simple to explore the relationships in your model and criterion queries.
You may make them unidirectional or bidirectional, meaning you can use them as a property on either one or both of the connected entities. It does not affect your database mapping tables, but it does specify the direction in which the connection may be used in model and criterion queries.
Hibernate enables collection mapping as a value type, and the collection is mapped into a separate table in this mapping.
When we need to save a class's property, whether it's a data type like integer, long, float, or an object of a wrapper class like a String, we save it directly in the class's table. If the class property is a collection type, we'll need to keep it in a separate collection table.
java.util.SortedSet- performs in-memory sorting and is mapped to the hibernating set> element, with the sort property used to customise the comparator implementation. TreeSet
The java.util. The collection class allows for duplicates and does not keep track of insertion orders.
ArrayList should be mapped to the hibernate implementation's bag> or idbag> element.
java.util.A key-value pair is referred to as a map.
java.util.SortedMap- is a key-value pair that performs sorting in memory.