Hibernate is a high-performance Object/Relational persistence and query service which is licensed under the open source GNU Lesser General Public License (LGPL). Hibernate not only takes care of the mapping from Java classes to database tables (and from Java data types to SQL data types), but also provides data query and retrieval facilities.
What is Hibernate :
Hibernate is an object-relational mapping (ORM) library for the Java language, providing a framework for mapping an object-oriented domain model to a traditional relational database.
Hibernate solves object-relational impedance mismatch problems by replacing direct persistence-related database accesses with high-level object handling functions. Advanced java training in Bangalore
Hibernate facilitates the storage and retrieval of Java domain objects via Object/Relational Mapping.
Hibernate Framework :
Hibernate framework simplifies the development of java application to interact with the database. Hibernate is an open source, lightweight, ORM (Object Relational Mapping) tool.
An ORM tool simplifies the data creation, data manipulation and data access. It is a programming technique that maps the object to the data stored in the database.
What Hibernate Does
- Map Java class to database tables & vice versa
- Data query and retrieval facility
- Generate the SQL query based on the underline DB and attempts to relieve the developer from manual result set handling and object conversion.
- Make application java training center Bangalore portable to all relational DB.
- Enhance performance by providing the different levels of cache(First, Second and Query level).
Advantages of Hibernate Framework
There are many advantages of Hibernate Framework. They are as follows:
1) Open source and Lightweight: Hibernate framework is open source under the LGPL license and lightweight.
2) Fast performance: The performance of hibernate framework is fast because cache is internally used in hibernate framework. There are two types of cache in hibernate framework first level cache and second level cache. First level cache is enabled by default.
3) Database Independent query: HQL (Hibernate Query Language) is the object-oriented version of SQL. It generates the database independent queries. So we don’t need to write database java/j2ee classes Bangalore specific queries. Before Hibernate, If database is changed for the project, we need to change the SQL query as well that leads to the maintenance problem.
4) Automatic table creation: Hibernate framework provides the facility to create the tables of the database automatically. So there is no need to create tables in the database manually.
5) Simplifies complex join: To fetch data from multiple tables is easy in hibernate framework.
6) Provides query statistics and database status: Hibernate supports Query cache and provide statistics about query and database status.
What is HQL
HQL is abbreviation of Hibernate Query Language. It is SQL inspired language provided by hibernate. Java course in Bangalore Developer can write SQL like queries to work with data objects.
What is Dialect
Each SQL vendor has its own set of supported syntax. This is known as dialect. In order to generate appropriate sql query Hibernate needs to know, for which DB query needs to be generated. Hibernate does it by org.hibernate.dialect.Dialect class and its subclass for each vendor.
Hibernate has its own internal connection pooling but it also support some third party connection pooling for production use.
- c3p0 connection pool
- Proxool connection pool
- Obtaining connections from an application server, using JNDI
Any Table in DB could be connected to other tables in same or other DB. And these tables could best core java training in Bangalore be associated with each other via some keys (Foreign ). Those kind of scenario can be handled with association.
Association mapping are used to map a Java Object to DB table.
Entities evolved in mappings:
- Class (Persistence)(POJO)
- DB Table
- Mapping file(.hbm)
Rules associated to POJO:
- POJO class needs to have default constructor as it is required by Hibernate.
- Lazy loading doesn’t work with Final class. It’s preferable to have Non Final classes.
Type of Association
1) Many To One
2) One to One
3) One to Many
Unidirectional Association with join Table
- Many To One java/j2ee classes bangalore
- One to One
- One to Many
- Many to Many
1) One to Many / Many to One
2) One to One
Bidirectional Association with join Table
1)One to Many / Many to One
2)One to One
3)Many to Many
Author : Infocampus is the best institute for the Advanced java training in Bangalore . It provides java training in less fees with the real time project . Every weekend mock test & mock interviews are conducted for the preparation of students . For java/j2ee classes assignment and hard copy of notes is provided to the students . Learn Hibernate , struts framework , Oops concept , serialization , singleton class in Core & Advanced java class. Infocampus provides best core java training in Bangalore
To book the seat for free demo java class call at : 9738001024 or to know the syllabus for java course enquire at : http://www.infocampus.co.in/java-training-bangalore.html