tropikalista tropikalista - 2 months ago 15
Java Question

Hibernate @PostLoad never gets invoked

Looked at many forums but haven't found answer...Simple stuff, method annotated with @PostLoad never gets invoked...added listener via @EntityListeners but problem remains. I'm using SessionFactory based configuration.

Answer

The EJB3 @PostLoad annotation doesn’t work when using a SessionFactory based configuration, the post-load method will never get called.

Either use Hibernate's Interceptors or events or an EntityManager based configuration.