Hibernate's primary feature is mapping from Java classes to database tables (and from Java data types to SQL data types). Hibernate also provides data query and retrieval facilities. Hibernate generates the SQL calls and relieves the developer from manual result set handling and object conversion, keeping the application portable to all SQL databases, with database portability delivered at very little performance overhead.
Hibernate provides transparent persistence for Plain Old Java Objects (POJOs). The only strict requirement for a persistent class is a no-argument constructor, not compulsorily public. (Proper behavior in some applications also requires special attention to the equals() and hashCode() methods.)
Hibernate provides a dirty checking feature that avoids unnecessary database write actions by performing SQL updates only on the modified fields of persistent objects.
Hibernate can be used both in standalone Java applications and in Java EE applications using servlets or EJB session beans.
41. What J2EE design problems does Hibernate solves apart from Data Base in-dependency and being an ORM tool?
1.The persistency complexety is migrated from DAO design pattern we just access pojo for the data
42. What the Core interfaces are of hibernate framework?
There are many benefits from these. Out of which the following are the most important one. i. Session Interface ? This is the primary interface used by hibernate applications. The instances of this interface are lightweight and are inexpensive to create and destroy. Hibernate sessions are not thread safe. ii. SessionFactory Interface ? This is a factory that delivers the session objects to hibernate application. Generally there will be a single SessionFactory for the whole application and it will be shared among all the application threads. iii. Configuration Interface ? This interface is used to configure and bootstrap hibernate. The instance of this interface is used by the application in order to specify the location of hibernate specific mapping documents. iv. Transaction Interface ? This is an optional interface but the above three interfaces are mandatory in each and every application. This interface abstracts the code from any kind of transaction implementations such as JDBC transaction, JTA transaction. v. Query and Criteria Interface ? This interface allows the user to perform queries and also control the flow of the query execution.
43. Why do you need ORM tools like hibernate?
It will help us to create, fetch, Update and delete using simple pojo (plain java Object).
The hiernate ORM's main benifit comes when we are using collection of databases or when we want to move from one database to the other
we need Hibernate like tools for the purpose of developing the application in short period of time.
44. why Hibernate came in to picture?
To make the application development more productive. Its saves development time and also mainly it deals with Objects(POJO) . and .xml file is nothing but mapping between database column and POJO variable. you can easily switch the database like MySql to Oracle you need not to change any of your code... just you can change a simple dialect in cfg file of hibernate to oracle it works with no error.
45. How does hibernate code looks like?
Session session = getSessionFactory().openSession();
Transaction tx = session.beginTransaction();
MyPersistanceClass mpc = new MyPersistanceClass ("Sample App");
session.save(mpc);
tx.commit();
session.close();
The Session and Transaction are the interfaces provided by hibernate. There are many
other interfaces besides this.
46. What are the different types of property and class mappings?
Typical and most common property mappingOr Derived properties Typical and most common property mapping Controlling inserts and updates
47. What should SessionFactory be placed so that it can be easily accessed?
As far as it is compared to J2EE environment, if the SessionFactory is placed in JNDI then it can be easily accessed and shared between different threads and various components that are hibernate aware. You can set the SessionFactory to a JNDI by configuring a property hibernate.session_factory_name in the hibernate.properties file.