Hibernate - What are Collection types in Hibernate?

What are Collection types in Hibernate?

- A collection is defined as a one-to-many reference. The simplest collection type in Hibernate is <bag>.

- This collection is a list of unordered objects and can contain duplicates. This is similar to java.util.List. The content of a collection is required for a SQL query. This won’t work until the code is actually accessed.

- This process has a benefit that allows the developer to separate the database access logic from that of the object traversal logic. This is called lazy collection.

- Filtering logic can be applied with lazy collection. This can alter the SQL which invokes when the actual collection is invoked.

What are Collection types in Hibernate?

- ArrayType, Constructor: ArrayType(String role, String propertyRef, Class elementClass, boolean isEmbeddedInXML)

- BagType, Constructor: BagType(String role, String propertyRef, boolean isEmbeddedInXML)

- CustomCollectionType: A custom type for mapping user-written classes that implement PersistentCollection
Constructor: CustomCollectionType(Class userTypeClass, String role, String foreignKeyPropertyName, boolean isEmbeddedInXML)

- IdentifierBagType, Constructor: IdentifierBagType(String role, String propertyRef, boolean isEmbeddedInXML)

- ListType, Constructor: ListType(String role, String propertyRef, boolean isEmbeddedInXML)

- MapType, Constructor: MapType(String role, String propertyRef, boolean isEmbeddedInXML)

- SetType, Constructor: SetType(String role, String propertyRef, boolean isEmbeddedInXML)

Hibernate - What is lazy initialization in hibernate?
What is lazy initialization in hibernate? - The delaying the object creation or calculating a value or some process until the first time it is needed...
Hibernate - What is lazy fetching in hibernate?
What is lazy fetching in hibernate? - Lazy fetching is associated with child objects loading for its parents..
Hibernate - Difference between sorted and ordered collection
Difference between sorted and ordered collection in hibernate - The sorted collection is a collection that is sorted using the Java collections framework....
Post your comment