What is hibernate framework?
Hibernate is a Object Object Relational Mapping(ORM) framework.ORM framework is used to map the objects in programming language such as Java to database objects such as table.Programmers can work with Java objects instead of working with the database tables.Since hibernate is a Java framework so it is used to map the Java objects
to database tables.The mappings between the table and java object is specified using XML file.
HQL stands for Hibernate Query Language.It is used to query objects.It is translated by hibernate to SQL queries.
What are the important benefits of using Hibernate Framework?
- ResultSet is transformed to Entities.Programmer works with entities instead of database tables
- Hibernate uses HQL language for querying.Unlike specific versions of SQL ,HQL is database independent.So same HQL query can be used across different databases.
- It allows to cache the results which prevents database hits.Hibernate supports lazy loading which improves performance.
How configuration is defined in Hibernate?
Configuration is defined using an XML file called hibernate.cfg.xml.It defines the database connection properties and the entity mapping files.
What is hibernate mapping file?
hibernate mapping file is a XML file which defines the mapping between the java objects and the database tables.
What are the advantages of Hibernate over JDBC?
- Hibernate works with all databases while JDBC works for a specific database
- Hibernate is easier to work as the programmer with objects while in JDBC programmer has to use SQL.
What is session in Hibernate?
Session is an interface between application and Hibernate.It provides operations for create,read,update and delete.To work with session you first open the session as:
Session session = sessionFactory.openSession();