HQL is own query language provided by the Hibernate.
HQL is provided to define database independent Queries.
HQL looks like SQL so, a programmer is no need of learning any seprate query language.
SQL queries contains table names and column names, whereas HQL contains variable names & class reference.
Lazy Loading
When an application is asking hibernate to load an object from database then Hibernate creates a proxy & returns back to the application
by without loading object from database.
When really an application is accessing the object then hibernate loads its data from database.
Lazy loading improves the performance by reducing the no. of tries between an application and a database.
Locking
Hibernate prevents overriding the changes of one transaction by another, with locks.
Hibernate provided two types of locks called- Optimistic and Pessimistic.
Caching
Hibernate stores the loaded objects from database in a cache.
If an application requires the same object in future the hibernate returns it from the cache.
Cache improves performance.
Hibernate maintains two levels of cache.
First Level
Second Level
Connection Pooling
Hibernate by default comes with a built-in connection pool.
It is also possible to configure external connection pool if required.
The built-in connection pool is created when application starts and it is closed when application terminated.
Criteria
This API of hibernate is used to prepare and execute tuned Queries on a database.
Tuned Queries will improve the performance of an application.
Filters
Filters allows the programmers to separate a base query and a required conditions these conditions are
At runtime filters can be enabled or disabled, to run the base query.
Interceptors
Hibernate interceptors are used to implement callback mechanism in hibernate.
Before a database operation is going to execute, we can define and execute some prerequisite or postrequisite operations as Interceptors.
No comments:
Post a Comment