Featured Post

NoSQL use cases

Here are a simple summary of use cases for Cassandra, MongoDB and Redis MongoDB Storing Log Data Speed is the primary perfor...

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