The largest Interview Solution Library on the web


Interview Questions
« Previous | 0 | 1 | 2 | 3 | 4 | Next »

41.What is many-to-many association?

A Many-to-Many mapping can be implemented using a Set java collection that does not contain any duplicate element. element indicates that one object relates to many other objects and column attributes are used to link intermediate column.

42.Is SessionFactory a thread-safe object?

Yes, SessionFactory is a thread-safe and can be accessed by multiple threads simultaneously.

43.What is the difference between save and persist methods of session object?

session.save saves the object and returns the id of the instance whereas persist do not return anything after saving the instance.

44.What is the difference between get and load methods of session object?

There are following differences between get and load methods.
get returns null if no data is present where as load throws ObjectNotFoundException exception in such case.
get always hits the database whereas load method doesn't hit the database.
get returns actual object whereas load returns proxy object.
A central feature of Hibernate, proxies, depends upon the persistent class being either nonfinal, or the implementation of an interface that declares all public methods.
All classes that do not extend or implement some specialized classes and interfaces required by the EJB framework.

45.What is lazy loading?

Lazy loading is a technique in which objects are loaded on demand basis. Since Hibernate 3, lazy loading is by default, enabled so that child objects are not loaded when parent is loaded.

46.What is HQL?

HQL stands for Hibernate Query Language. It takes java objects in the same way as SQL takes tables. HQL is a Object Oriented Query language and is database independent.

47.What is first level cache in hibernate?

The first-level cache is the Session cache and is a mandatory cache through which all requests must pass. The Session object keeps an object under its own power before committing it to the database.

48.What is second level cache in hibernate?

Second level cache is an optional cache and first-level cache will always be consulted before any attempt is made to locate an object in the second-level cache. The second-level cache can be configured on a per-class and per-collection basis and mainly responsible for caching objects across sessions.

49.What is Query level cache in hibernate?

Hibernate also implements a cache for query resultsets that integrates closely with the secondlevel cache.
This is an optional feature and requires two additional physical cache regions that hold the cached query results and the timestamps when a table was last updated. This is only useful for queries that are run frequently with the same parameters.

50.What are concurrency strategies?

A concurrency strategy is a mediator which responsible for storing items of data in the cache and retrieving them from the cache. If you are going to enable a second-level cache, you will have to decide, for each persistent class and collection, which cache concurrency strategy to use.
Transactional: Use this strategy for read-mostly data where it is critical to prevent stale data in concurrent transactions,in the rare case of an update.
Read-write: Again use this strategy for read-mostly data where it is critical to prevent stale data in concurrent transactions,in the rare case of an update.
Nonstrict-read-write: This strategy makes no guarantee of consistency between the cache and the database. Use this strategy if data hardly ever changes and a small likelihood of stale data is not of critical concern.
Read-only: A concurrency strategy suitable for data which never changes. Use it for reference data only.

51.What is Next ?

Further you can go through your past assignments you have done with the subject and make sure you are able to speak confidently on them. If you are fresher then interviewer does not expect you will answer very complex questions, rather you have to make your basics concepts very strong. Second it really doesn't matter much if you could not answer few questions but it matters that whatever you answered, you must have answered with confidence. So just feel confident during your interview. We at tutorialspoint wish you best luck to have a good interviewer and all the very best for your future endeavor. Cheers :-)

52.What does ORM consists of ?

ORM solution consists of the followig four pieces:
• API for performing basic CRUD operations
• API to express queries refering to classes
• Facilities to specify metadata
• Optimization facilities : dirty checking,lazy associations fetching

53.What are the ORM levels ?

The ORM levels are:
• Pure relational (stored procedure.)
• Light objects mapping (JDBC)
• Medium object mapping
• Full object Mapping (composition,inheritance, polymorphism, persistence by reachability)

54.What is Hibernate?

Hibernate is a pure Java object-relational mapping (ORM) and persistence framework that allows you to map plain old Java objects to relational database tables using (XML) configuration files.Its purpose is to relieve the developer from a significant amount of relational data persistence-related programming tasks.

55.Why do you need ORM tools like hibernate?

The main advantage of ORM like hibernate is that it shields developers from messy SQL. Apart from this, ORM provides following benefits:
Improved productivity
o High-level object-oriented API
o Less Java code to write
o No SQL to write
Improved performance
o Sophisticated caching
o Lazy loading
o Eager loading
Improved maintainability
o A lot less code to write
Improved portability
o ORM framework generates database-specific SQL for you

56.What Does Hibernate Simplify?

Hibernate simplifies:
• Saving and retrieving your domain objects
• Making database column and table name changes
• Centralizing pre save and post retrieve logic
• Complex joins for retrieving related items
• Schema creation from object model

57.What is the need for Hibernate xml mapping file?

Hibernate mapping file tells Hibernate which tables and columns to use to load and store objects. Typical mapping file look as follows:

58.What are the most common methods of Hibernate configuration?

The most common methods of Hibernate configuration are:
• Programmatic configuration • XML configuration (hibernate.cfg.xml)

59.What are the important tags of hibernate.cfg.xml?

Following are the important tags of hibernate.cfg.xml:

60.What are the Core interfaces are of Hibernate framework?

People who read this, also read:-
• XML Interview Questions
• BREW Questions
• SCJP 5.0 Certification
• JSF Integration with Spring Framework
Spring Interview Questions
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

« Previous | 0 | 1 | 2 | 3 | 4 | Next »


copyright © 2014 - all rights riserved by javatechnologycenter.com