What does Hibernate.initialize do?

Mike picture Mike · Oct 29, 2013 · Viewed 21.4k times · Source

What does Hibernate.initialize do?
Usually referred documentation talk only about

Hibernate.initialize(entity.lazyCollection)

Is there any sense in

Hibernate.initialize(entity)

Answer

Alan Hay picture Alan Hay · Oct 29, 2013

I would say yes if the Entity has a lazily initialized field e.g. some large BLOB or CLOB data or a lazy one-to-one association. See 20.1.8. in the documentation for the former and 20.1.3 for the latter.

See also:

20.1.4. Initializing collections and proxies