Develop a trigger in hibernate as follows:
public class extends ValidarCidTrigger EmptyInterceptor {
// Implementation of class
}
// Add the following line of code to the persistence.xml file
<property name = "hibernate.ejb.interceptor" value = "gehos.comun.util.ValidarCidTrigger" />
The problem is that the interceptor is global and what I want is to run per session. Sorry for my english...
AFAIK, you can't do that but you have acces to SessionContext in your interceptor .
Contexts.getSessionContext(); Identity.instance().getUsername();
why do you need that ? there are different ways of doing things in Seam