Q. What is ORM?
A. The relation between object and database for persisting object to store into a database table is known as Object Relational Mapping (ORM). In the case of ORM framework they are using metadata and/or annotation for mapping ,ibatis and Hibernate are most popular ORM framework in java.
Q. What does ORM solution consists of?
A. An ORM solution consists of :-
1. The CRUD operational activities performing by ORM framework specific API.
2. API for specifying queries that refer to classes.
3. A facility for specifying mapping metadata.
4. A technique for the ORM implementation to interact with transactional objects to perform dirty checking, lazy association fetching, and other optimization functions.
Q.List the different levels of ORM quality?
A. The different levels of ORM quality are given below:-
1.Pure relational
The entire application, including the user interface, designed around the relational model and SQL based relational operations, but the drawbacks, such as lack of portability and maintainability issues occurs in the long run. This type of application is using stored procedure for implementing more business logic instead of business layer.
2.Light object mapping
This type of implementations manually written code for mapping relational tables
The entities are represented as classes that are mapped manually to the relational tables. The code SQL/JDBC is hidden from the business logic using specific design patterns. This approach is successful for applications with a less number of entities, or applications with common, metadata-driven data models.
3.Medium object mapping
The application is designed around an object model. The SQL code is generated at build time. And the associations between objects are supported by the persistence mechanism, and queries are specified using an object-oriented expression language. This is best suited for medium-sized applications with some complex transactions.
4.Full object mapping
Full object mapping supports sophisticated object modeling such as inheritance, polymorphism, composition and persistence. The persistence layer implements transparent persistence. Persistent classes do not inherit any special base class or have to implement a special interface. Efficient fetching strategies and caching strategies are implemented transparently to the application.
Q. List the benefits of ORM and Hibernate?
A. ORM and Hibernate provides the following benefits:-
- Productivity
High-level object-oriented API improve less java code to write and support No SQL which significantly reduce development time. - Performance
Support many third party caching include inbuilt primary caching, lazy loading and eager loading. - Maintainability
Segregate code to their implementation and reducing code to write using HQL. - Portability
ORM framework decouple database-specific SQL into their implementation by using HQL and named query.
Q.What is Hibernate?
A. Hibernate is a tool built specifically for managing the mapping between Java objects and database tables, usually referred to as Object Relational Mapping, or ORM.Hibernate is an ORM and persistent framework that helps to map plain java object (POJO) to relational database table using xml configuration file.
Q.How many ways of entity mapping in hibernate?
A. In the context of entity mapping, this refers to the three different approaches offered by Hibernate ORM-
1.Annotation-based mapping with classic Hibernate-specific annotations.
2.Annotation-based mapping with the Java Persistence API (JPA 2.0)
3.XML-based mapping with hbm.xml files.
Q.What are the most common methods of Hibernate configuration?
A.The most common methods of Hibernate configuration are:
1.Programmatic configuration.
2.XML configuration (hibernate.cfg.xml).
Q.Name the Core interfaces of Hibernate framework?
A.The five core interfaces of Hibernate application are:-
- Session interface
- SessionFactory interface
- Configuration interface
- Transaction interface
- Query and Criteria interface
By using these interfaces, you can store and retrieve persistent objects and control the transactions.
What are the different states of Hibernate object
A. Hibernate supports the following object states.
- Transient : An object is transient if it is instantiated using the new operator, and it is not associated with a Hibernate Session.
- Persistent : A persistent instance has a representation in the database and an identifier value. It might just have been saved or loaded, however, it is by definition in the scope of a Session.
- Detached : A detached instance is an object that has been persistent, but its Session has been closed.
Q. What is the default cache service of hibernate?
A. Hibernate supports multiple cache services such as OSCache, SWARMCache and TreeCache and their default cache service is EHCache.
I like this post, enjoyed this one appreciate it for posting .