cdalxndr
cdalxndr

Reputation: 1541

How to force hibernate to return proxy

I have a scenario where everything works fine in dev environment, but fails in production due to proxies being returned instead of actual entities.

How can I force hibernate to return proxies so that I can test this behavior before deploying in production?

Upvotes: 0

Views: 390

Answers (1)

Christian Beikov
Christian Beikov

Reputation: 16420

Use EntityManager.getReference to get a proxy. Note though, that if an entity is already part of a persistence context, it will return that entity.

Upvotes: 1

Related Questions