0

I wrote a Custom Listener. But when i tries to set it in Hibernate Configuration as in

Configuration configuration=new Configuration().setListener("save-Update",XYZClass);

It states that there is no function with the name setListener. Help me out what am i doing wrong. My Hibernate Version id 4.02

1 Answers1

1

Hibernate 4.x do not have setListener method, this method is available in Hibernate 3.x version only.

In Hibernate 4.x you can use interceptors, go through this link for details:

Chapter 14. Interceptors and events Hibernate interceptor example

This SO post has some details on how to use Listeners in Hibernate 4.x, you can have a look at this:

eventlisteners using hibernate 4.0 with spring 3.1.0.release?

Community
  • 1
  • 1
Chaitanya
  • 15,403
  • 35
  • 96
  • 137