Featured Post

Scalability Techniques

Scalability is about the capability of a system to manage the increase workload of a system without causing qualities impact (i.e. perfo...

Tuesday, April 14, 2015


The main difference between find and get methods of EntityManager is that:
  • EntityManager find: return an object according to the fetch policy.
  • EntityManager getReference: return an hollow object. This object is lazy initialized, it only has the primary key populated.

The main difference is that EntityManager#getReference method is useful in the situation you need only the primary key of the requested object. An possible example is when you have to use the hollow object as part of an insert statement where only the reference of that object is useful.

No comments :

Post a Comment