Interview questions

What are Collection types in Hibernate?

<<Previous  Next>>

Hibernate - What are Collection types in Hibernate? - Feb 04, 2009 at 8:10 am by Vidya Sagar

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.

Hibernate - What are Collection types in Hibernate? - Nov 19, 2009 at 16:50 am by Amit Satpute

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)

Also read

Explain the role of Session interface in Hibernate.

Session interface is a single threaded object. The representation of single unit of work with the Java application and the persistence database is done by this object..........

What is Hibernate Query Language (HQL)?

Hibernate Query Language is designed for data management using Hibernate technology. It is completely object oriented and hence has notions like inheritance, polymorphism and abstraction.............

<<Previous  Next>> 

Write your comment - Share Knowledge and Experience


 

 
Latest placement tests
Latest links
 
 
Home | Want a Job? Submit Key Skills | Employer login | My key skills | About us | Sitemap | Contact us