Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. @Transactional
  2. public class CustomerService {
  3.  
  4.   @Inject
  5.   private EntityManager em;
  6.   @Inject
  7.   private Logger logger;
  8.  
  9.   public void createCustomer(Customer customer) {
  10.     em.persist(customer);
  11.   }
  12.  
  13.   public Customer findCustomerById(Long id) {
  14.     return em.find(Customer.class, id);
  15.   }
  16.  
  17.   @AroundInvoke
  18. private Object logMethod( InvocationContext ic ) throws Exception {
  19.     logger.entering( ic .getTarget().toString(), ic .getMethod().getName());
  20.     try {
  21.       return ic.proceed() ;
  22.     } finally {
  23.       logger.exiting( ic .getTarget().toString(), ic .getMethod().getName());
  24.     }
  25.   }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement