Вопрос

I have a class like this:

@Entity
@Customizer(value=UsuarioCustomizer.class)
@Indexes({
    @Index(name="idx_login_senha",columnNames={"usuario","senha"})
})
@EntityListeners({Hashr.class})
public class Usuario implements Serializable{
  private static final long serialVersionUID = 1L;
  // Fields

and here is Hashr

public class Hashr {

    @PrePersist
    @PreUpdate
    public void doHash(Object o){
          // print info
    }
}

but it happens that this method is never called...Any ideas? Did I forgot something?

Это было полезно?

Решение

This should be called. Enable logging on finest and see if any errors are logged.

Ensure you have recompiled/deployed your code.

What environment are you running in? Ensure you list the listener class in your persistence.xml classes.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top