Listen in hibernate?

0

I have this class the problem arises when I persist an instance does not recognize the listener and does not perform the action before persisting.

    
asked by 27.06.2017 в 04:56
source

1 answer

1

You can try the @PrePersist annotation, it will run automatically before inserting into the database. And you create the method that you want to be executed during that action. It would be something like this:

 @PrePersist
 private void metodoAEjecutar() {
    //Código a ejecutar
 }
    
answered by 27.06.2017 в 18:03