Reputation: 1541
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
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