Showing posts with label hibernate interview questions. Show all posts
Showing posts with label hibernate interview questions. Show all posts

Use Configuration Interface in hibernate?

What’s the usage of Configuration Interface in hibernate?
Configuration interface of hibernate framework is used to configure hibernate. It’s also used to bootstrap hibernate. Mapping documents of hibernate are located using this interface.




www.cinterviews.com appreciates your contribution please mail us the questions you have to cinterviews.blogspot.com@gmail.com so that it will be useful to our job search community

What is ORM? Hibernate interview Question

What is ORM? Hibernate interview Question
ORM (Object Relational Mapping) is the fundamental concept of Hibernate framework which maps database tables with Java Objects and then provides various API’s to perform different types of operations on the data tables.

www.cinterviews.com appreciates your contribution please mail us the questions you have to cinterviews.blogspot.com@gmail.com so that it will be useful to our job search community

What is Hibernate? interview Question

What is Hibernate? interview Question
Hibernate is a popular framework of Java which allows an efficient Object Relational mapping using configuration files in XML format. After java objects mapping to database tables, database is used and handled using Java objects without writing complex database queries.
www.cinterviews.com appreciates your contribution please mail us the questions you have to cinterviews.blogspot.com@gmail.com so that it will be useful to our job search community

Hibernate interview questions and answers

 Hibernate interview questions and answers
1. What’s Hibernate?
2. What is ORM?
3. How properties of a class are mapped to the columns of a database table in Hibernate?
4. What’s the usage of Configuration Interface in hibernate?
5. How can we use new custom interfaces to enhance functionality of built-in interfaces of hibernate?
6. Should all the mapping files of hibernate have .hbm.xml extension to work properly?
7. How do we create session factory in hibernate?
8. What are POJOs and what’s their significance?
9. What’s HQL?
10. How can we invoke stored procedures in hibernate?
11. What is criteria API?
12. What are the benefits of using Hibernate template?
13. How can we see hibernate generated SQL on console?
14. What are the two types of collections in hibernate?
15. What’s the difference between session.save() and session.saveOrUpdate() methods in hibernate?
16. What the benefits are of hibernate over JDBC?
17. How can we get hibernate statistics?
18. What is transient instance state in Hibernate?
19. How can we reduce database write action times in Hibernate?
20. What’s the usage of callback interfaces in hibernate?
21. When an instance goes in detached state in hibernate?
22. What the four ORM levels are in hibernate?
23. What’s transaction management in hibernate? How it works?
24. What the two methods are of hibernate configuration?
25. What is the default cache service of hibernate?
26. What are the two mapping associations used in hibernate?
27. What’s the usage of Hibernate QBC API?
28. In how many ways, objects can be fetched from database in hibernate?
29. How primary key is created by using hibernate?
30. How can we reattach any detached objects in Hibernate?
31. What are different ways to disable hibernate second level cache?
32. What is ORM metadata?
33. Which one is the default transaction factory in hibernate?
34. What’s the role of JMX in hibernate?
35. How can we bind hibernate session factory to JNDI ?
36. In how many ways objects can be identified in Hibernate?
37. What different fetching strategies are of hibernate?
38. How mapping of java objects is done with database tables?
39. What are derived properties in hibernate?
40. What is meant by a Named SQL Query in hibernate and how it’s used?
41. What’s the difference between load() and get() method in hibernate?
42. What’s the use of version property in hibernate?
43. What is attribute oriented programming?
44. What’s the use of session.lock() in hibernate?
45. Does hibernate support polymorphism?
46. What the three inheritance models are of hibernate?
47. How can we map the classes as immutable?
48. What’s general hibernate flow using RDBMS?
49. What is Light Object Mapping?
50. What’s difference between managed associations and hibernate associations?              
                               
www.cinterviews.com appreciates your contribution please mail us the questions you have to cinterviews.blogspot.com@gmail.com so that it will be useful to our job search community

Core interfaces of Hibernate framework

Core interfaces 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 core components in Hibernate ?

What are the core components in Hibernate ?

SessionFactory (org.hibernate.SessionFactory)
A threadsafe (immutable) cache of compiled mappings for a single database. A factory for Session and a client of ConnectionProvider. Might hold an optional (second-level) cache of data that is reusable between transactions, at a process- or cluster-level.
Session (org.hibernate.Session)
A single-threaded, short-lived object representing a conversation between the application and the persistent store. 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.
Persistent objects and collections
Short-lived, single threaded objects containing persistent state and business function. These might be ordinary JavaBeans/POJOs, the only special thing about them is that they are currently associated with (exactly one) Session. As soon as the Session is closed, they will be detached and free to use in any application layer (e.g. directly as data transfer objects to and from presentation).
Transient and detached objects and collections
Instances of persistent classes that are not currently associated with a Session. They may have been instantiated by the application and not (yet) persisted or they may have been instantiated by a closed Session.
Transaction (org.hibernate.Transaction)
(Optional) A single-threaded, short-lived object used by the application to specify atomic units of work. Abstracts application from underlying JDBC, JTA or CORBA transaction. A Session might span several Transactions in some cases. However, transaction demarcation, either using the underlying API or Transaction, is never optional!
Architecture
Hibernate 3.0.2 9
ConnectionProvider (org.hibernate.connection.ConnectionProvider)
(Optional) A factory for (and pool of) JDBC connections. Abstracts application from underlying Datasource or DriverManager. Not exposed to application, but can be extended/implemented by the developer.
TransactionFactory (org.hibernate.TransactionFactory)
(Optional) A factory for Transaction instances. Not exposed to the application, but can be extended/ implemented by the developer.
Extension Interfaces
Hibernate offers many optional extension interfaces you can implement to customize the behavior of your persistence layer. See the API documentation for details.

What is the difference between hibernate and jdbc ?

What is the difference between hibernate and jdbc ?
1) Hibernate is data base independent, In case of JDBC query must be data base specific.
2) As Hibernate is set of Objects , SQL Language learning is not required. TABLE can be treated as Java Object 3) Don?t need Query tuning in case of Hibernate. If you use Criteria Quires in Hibernate then hibernate automatically tuned your query and return best result with performance. In case of JDBC you need to tune your queries.
4) You will get benefit of Cache. Hibernate support two level of cache. First level and 2nd level. So you can store your data into Cache for better performance. In case of JDBC you need to implement your java cache .
5) Hibernate supports Query cache and It will provide the statistics about your query and database status. JDBC Not provides any statistics.
6) Development fast in case of Hibernate because you don?t need to write queries
7) No need to create any connection pool in case of Hibernate. You can use c3p0. In case of JDBC you need to write your own connection pool
8) In the xml file you can see all the relations between tables in case of Hibernate. Easy readability.
9) You can load your objects on start up using lazy=false in case of Hibernate. JDBC Don?t have such support. <> 10 ) Hibernate Supports automatic versioning of rows but JDBC does not.