Define ORM and benefits of ORM with Hibernate
Answer: ORM in terms of Hibernate ORM or Hibernate is object relational mapping API library for java language which provides framework to map an object oriented domain model to relational database. It was mismatch issue when persisting object to the database which hibernate solves by replacing direct persistence related database accesses using its high level of object handling functions.
Hibernate ORM also gives flexibility to the programmers to write application easily whose data outlives application process.
Benefits of ORM with Hibernate:
- Extensibility: Hibernate is highly extensible and configurable
- Reliable: In terms of reliability it has given superb stability and good quality which has been proved its acceptance by companies including many thousands of java programmers.
- High Performance: Compare to conventional method of writing JDBC code to connect database and persist objects hibernate offers excellent performance in terms of run time performance of the application and programmer productivity. Hibernate support many fetching strategies and locking using its functionality time stamping, automatic versioning and lazy initialization. It involves nothing special database tables or fields and generates many of SQL when system initializes instead of generate it at run time.
- Scalability: Hibernate has been designed to fit in application server cluster environment and scalable architecture. It fits well in all environments for example: if you are writing critical application which will be severed to many thousands of clients or company intranet where it will be severed to hundreds of users.
- JPA Provider: Hibernate has its own native API and also it is an implementation of Java Persistence API (JPA) specification. Because of JPA specification implementation it can be used straightforwardly all environment which supports JPA including Java EE applications, application servers Java SE, enterprise application etc…
- Idiomatic persistence: Hibernate fully supports object oriented concept which includes aggregation, composition, inheritance, polymorphism, association java Java collection framework. Hibernate needs no base classes or interfaces for persistent classes and it enables class or data structure be persistent.