Header Ads

  • Breaking Now

    What are core interfaces for Hibernate framework?

    Most Hibernate-related application code primarily interacts with four interfaces provided by Hibernate Core:

    org.hibernate.Session
    org.hibernate.SessionFactory
    org.hibernate.Criteria
    org.hibernate.Query

    The Session is a persistence manager that manages operation like storing and retrieving objects. Instances of Session are inexpensive to create and destroy. They are not thread safe.

    The application obtains Session instances from a SessionFactory. SessionFactory instances are not lightweight and typically one instance is created for the whole application. If the application accesses multiple databases, it needs one per database.

    The Criteria provides a provision for conditional search over the resultset.One can retrieve entities by composing Criterion objects. The Session is a factory for Criteria.Criterion instances are usually obtained via the factory methods on Restrictions.

    Query represents object oriented representation of a Hibernate query. A Query instance is obtained by calling Session.createQuery().

    Post Top Ad

    Post Bottom Ad