FileDocCategorySizeDatePackage
LoggingBefore.javaAPI DocExample832Mon Apr 25 06:18:08 BST 2005com.springbook

LoggingBefore

public class LoggingBefore extends Object implements org.springframework.aop.MethodBeforeAdvice

Fields Summary
private net.sf.hibernate.SessionFactory
factory
Constructors Summary
Methods Summary
public voidbefore(java.lang.reflect.Method method, java.lang.Object[] objects, java.lang.Object o)

      Session s = null;
      LogEvent le = new LogEvent(method.getName(), new Date());
      try {
         s = factory.openSession();
         s.save(le);
      } catch (Exception ex) {
         // log the exception
      } finally {
         s.close();
      }
   
public net.sf.hibernate.SessionFactorygetSessionFactory()

      return this.factory;
   
public voidsetSessionFactory(net.sf.hibernate.SessionFactory factory)

      this.factory = factory;