What are derived properties?
The properties that are not mapped to a column, but calculated at runtime by evaluation of an expression are called derived properties. The expression can be defined using formula attribute of the element. Reply
What is Hibernate Query Language (HQL)?
Hibernate offers a query language which is powerful and provides flexible mechanism to query, store, update and retrieve objects from database. This HQL is an object oriented extension to SQL. Hibernate query Language (HQL) is an object-oriented extension to SQL.Reply
What are different levels of ORM quality?
There are four levels defined for ORM quality:
* Pure relational: The entire application, including the UI is designed around the relational model and SQL based relational operation.
* Light Object Mapping: The entities are represented as classes that are mapped manually to the relational tables. The code is hidden from the business logic using specific design patterns.
* Medium Object Mapping: The application is designed around an object model. The SQL code is generated at build time, and the association between objects is 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.
* Full Object Mapping: Full Object Mapping supports sophisticated object modeling, composition, inheritance, polymorphism and persistence. Reply
Is SessionFactory a thread safe object ?
Yes! SessionFactory object is threadsafe. Many threads can request for session and immutable cache of compiled mappings for a single database. Reply
How will you configure Hibernate?
What role does the Session interface play in Hibernate?
The Session is a persistence manager that manages operation like storing and retrieving objects. Instances of Session are inexpensive to create and destroy. They are not threadsafe. The Session interface is the primary interface used by Hibernate applications. It is a single-threaded, short-lived object representing a conversation between the application and the persistent store. It allows you to create ry objects to retrieve persistent objects.
Session session = sessionFactory.openSession();
Session interface play roles in:
* Wraps a JDBC connection
* Factory for Transaction
* Holds a mandatory (first-level) cache of persistent objects, used when navigating the object graph or looking up objects by identifier.Reply
what is lazy initialisation in hibernate?
Hibernate supports the feature of lazy initilasation for both entities and collections. What this actually means is, the Hibernate engine loads only those objects that we are querying for and doesnt try to fetch other entities(that are associated with the entity we are querying) or collections.
Hibernate loads collection elements only when actually you ask for them by saying lazy=true or lazy=false.
<set name="Child" lazy="false" inverse="true">
How to call stored procedure in mysql through hibernate?
If your stored procedure is returning a value you can directly use <sql-query>, otherwise you need to use jdbc connection to call the native sql procedure.
Session session = getHibernateTemplate().getSessionFactory().openSession();
/*if you are not using session factory, you can use ur own method to get session.*/
Connection conn = session.connection();
String sqlQuery = "call VersionUpdateProcedure()";
CallableStatement cs = conn.prepareCall(sqlQuery);
What are the Core interfaces are of Hibernate framework?
The five core interfaces are used in just about every Hibernate application. Using these interfaces, you can store and retrieve persistent objects and control transactions.
* Session interface
* SessionFactory interface
* Configuration interface
* Transaction interface
* Query and Criteria interfaces
What are the most common methods of Hibernate configuration?
The two most common methods of Hibernate configuration are:
* Programmatic configuration
* XML configuration (hibernate.cfg.xml) Reply