Hello.
I'm trying to use Hibernate 4 for a new project, but I found that the documentation is incorrect on some aspects. One of that is how to programmatically add event listeners, the documentation says to call cfg.EventListeners().setLoadEventListeners(stack); but, as far as I can tell, there is no EventListener method on Configuration (nor getEventListener not anything that resembles such behaviour).
I readed that Hibernate 4 migrated some stuff as services and found some code, mainly in the issue tracker, but all code I tried do not work, I get null pointer exceptions from weird places and it doesn't tell anything about what's wrong or how to do things right.
So, can anyone post a sample code on how to programmatically initialize an Hibernate 4 environment, including postCreate/Modify/Delete event listeners ?
Thanks.
|