More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Ans. It's a feature to lazily initialize dependencies , relationship and associations from the Database. Any related references marked as @OneToMany or @ManyToMany are loaded lazily i.e when they are accessed and not when the parent is loaded.
Ans. 1. First level cache is enabled by default whereas Second level cache needs to be enabled explicitly.
2. First level Cache came with Hibernate 1.0 whereas Second level cache came with Hibernate 3.0.
3. First level Cache is Session specific whereas Second level cache is shared by sessions that is why First level cache is considered local and second level cache is considered global.
Help us improve. Please let us know the company, where you were asked this question :
Ans. HBM Files ( Mapping )
DB Connection ( DB Connection String , User Name , Password , Pool Size )
SQL Dialect ( SQL variant to be generated )
Show SQL ( Show / No show SQL on Console )
Auto Commit ( True / False )
Help us improve. Please let us know the company, where you were asked this question :
Ans. 1. Configure Provider class in Hibernate configuration file.
2. Add Cache usage tag ( read-only or read-write ) in mapping files ( hbm ).
3. Create an XML file called ehcache.xml and place in classpath which contains time settings and update settings, behavior of cache , lifetime and idletime of Pojos, how many objects are allowed.
Help us improve. Please let us know the company, where you were asked this question :
Ans. This annotation is added to the auto increment column with the strategy to increment the column value. Usually this is added to the surrogate primary key column and specified with the Database Sequence.
Help us improve. Please let us know the company, where you were asked this question :
Ans. 1. No need to know SQL, RDBMS, and DB Schema. 2. Underlying Database can be changed without much effort by changing SQL dialect and DB connection. 3.Improved Performance by means of Caching.
Help us improve. Please let us know the company, where you were asked this question :
Ans. If id doesnt exist in the DB load throws an exception whereas get returns null in that case.get makes the call to DB immediately whereas load makes the call to proxy.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Spring caching makes use of its intercepting capabilities to add caching to method calls. Therefore, the entire object is cached and reused. Hibernate, on the other hand, has more domain-specific knowledge of the Entity being cached and can handle the objects more appropriately.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Lazy fetching is the technique of not loading the child objects when parent objects are loaded. By default Hibernate does not load child objects. One can specify whether to load them or not while doing the association.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Transient - In this state, an instance is not associated with any persistence context Persistent - In this state, an instance is associated with a persistence context Detached - This is a state for an instance which was previously associated with a persistence context an has been currently closed dissociated
Help us improve. Please let us know the company, where you were asked this question :