1 25 package org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger; 26 27 import javax.ejb.Remote ; 28 import javax.ejb.Stateless ; 29 import javax.persistence.EntityManager; 30 import javax.persistence.EntityManagerFactory; 31 import javax.persistence.PersistenceUnit; 32 33 import org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackLogger; 34 import org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType; 35 36 42 @Stateless (name="SLSBCallbackLoggerAccess") 43 @Remote (ItfCallbackLoggerAccess.class) 44 public class SLSBCallbackLoggerAccess extends CallbackLoggerAccessBase implements ItfCallbackLoggerAccess{ 45 46 49 @PersistenceUnit 50 private EntityManagerFactory entityManagerFactory; 51 52 53 61 public void insertCallbackLogger(final String className, 62 final CallbackType callbackEvent, final String callbackClassName) { 63 EntityManager entityManager = entityManagerFactory.createEntityManager(); 64 65 CallbackLogger logger = new CallbackLogger(); 66 logger.setCallbackClassName(callbackClassName); 67 logger.setCallbackEvent(callbackEvent); 68 logger.setClassName(className); 69 logger.setInsertionDate(getTime()); 70 entityManager.persist(logger); 71 entityManager.flush(); 72 } 73 } 74 | Popular Tags |