Search in sources :

Example 6 with PreUpdate

use of javax.persistence.PreUpdate in project deltaspike by apache.

the class AuditEntityListener method update.

@PreUpdate
public void update(Object entity) {
    BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
    Set<Bean<?>> beans = beanManager.getBeans(PreUpdateAuditListener.class);
    for (Bean<?> bean : beans) {
        PreUpdateAuditListener result = (PreUpdateAuditListener) beanManager.getReference(bean, PreUpdateAuditListener.class, beanManager.createCreationalContext(bean));
        result.preUpdate(entity);
    }
}
Also used : BeanManager(javax.enterprise.inject.spi.BeanManager) Bean(javax.enterprise.inject.spi.Bean) PreUpdate(javax.persistence.PreUpdate)

Aggregations

PreUpdate (javax.persistence.PreUpdate)6 Date (java.util.Date)4 PrePersist (javax.persistence.PrePersist)3 Timestamped (com.spaceprogram.simplejpa.model.Timestamped)1 EJBContext (javax.ejb.EJBContext)1 Bean (javax.enterprise.inject.spi.Bean)1 BeanManager (javax.enterprise.inject.spi.BeanManager)1 InitialContext (javax.naming.InitialContext)1 NamingException (javax.naming.NamingException)1