Q. How does hibernate support lazy loading? A. Hibernate uses a proxy object to support lazy loading. Basically as soon as you reference a child or lookup object via the accessor/getter …
Q. How does hibernate support lazy loading? A. Hibernate uses a proxy object to support lazy loading. Basically as soon as you reference a child or lookup object via the accessor/getter …
NonUniqueObjectException is thrown when there is an object already associated with the session with the same id (primary key) (i.e. a duplicate). It is important to understand the concept of a …
LazyInitializationException is thrown when an object becomes detached, and if you try to access associated (i.e. proxied) object(s) of a detached object.
When …
In the log4j.properties file, you can enable Hibernate SQL logging as shown below
1 2 |
log4j.logger.org |
Hibernate does require the same EntityManager to be available in order to lazily load objects. If you have no EntityManager, then you have no knowledge of the datastore. Once the transaction …
Q1. What do you understand by automatic dirty checking in Hibernate? A1. Dirty checking is a feature of hibernate that saves time and effort to update the database when states of …
There are certain generic columns that database tables have like Auto generated identity columns. Auditing columns like createdDtTm, createdBy, modifiedDtTm, and modifiedBy. Soft delete or logical delete flags like inactive ‘Y’ …
Example #1 Wiring JDBC Datasource
Here is a sample maven pom.xml snippets containing the dependency jars.
1 2 3 4 5 6 7 |
.... <hibernate.version |
There are times you want to define a custom data type in Hibernate. Here is an example of using a custom ImageType defined as a Blob databse type to store images, …
FAQ Hibernate interview questions & answers are covered below.
Q1. What is an Object-to-Relational Mapping (i.e. ORM) tool?
A1. There are several ways to persist data to …
Q. What is a first-level cache in Hibernate? A. First-level cache always is associated with a “Session” object. Hibernate uses this cache by default. You can’t turn it off. Hibernate caches …
Extends 15+ Hibernate interview questions & answers – Q1 – Q7. Hibernate interview questions & answers with diagrams & code snippets to not only prepare for the job interviews, but also …
This is not only a job interview companion, but also a career companion for a quick reference & brush-up on a topic or category to proactively fast-track your career.