Blog Archives

03: Identifying and fixing NonUniqueObjectException in Hibernate

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 “detached”

Read more ›

04: Identifying and fixing LazyInitializationException in Hibernate

LazyInitializationException is thrown when an object becomes detached, and if you try to access associated (i.e. proxied) object(s) of a detached object.

Q. What is a detached object in Hibernate?

Read more ›

05: Debugging Hibernate & handling 4 common issues

#1. Enable Logging in your log4j.xml,, or myapp-logback.xml

In the file, you can enable Hibernate SQL logging as shown below

or in your log4j.xml or myapp-logback.xml as

You can then check your logs for the SQLs executed and the parameters passed.

Read more ›

300+ Java Developer Interview Q&As

800+ Java Interview Q&As