Class SessionFactory

  • All Implemented Interfaces:
    org.aopalliance.aop.Advice, org.aopalliance.intercept.Interceptor, org.aopalliance.intercept.MethodInterceptor

    public class SessionFactory
    extends java.lang.Object
    implements org.aopalliance.intercept.MethodInterceptor
    Simple source of Thread-aware Session instances. Wraps a call to SessionFactoryUtils. Should be safe to call from within any service implementation call or inside of Executor.execute.
    Since:
    4.0
    • Constructor Summary

      Constructors 
      Constructor Description
      SessionFactory​(org.hibernate.SessionFactory factory, ome.util.SqlAction isolatedSqlAction)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.hibernate.Session getSession()
      Returns a session active for the current thread.
      java.lang.Object invoke​(org.aopalliance.intercept.MethodInvocation mi)
      Wraps all invocations to Session to prevent certain usages.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SessionFactory

        public SessionFactory​(org.hibernate.SessionFactory factory,
                              ome.util.SqlAction isolatedSqlAction)
    • Method Detail

      • getSession

        public org.hibernate.Session getSession()
        Returns a session active for the current thread. The returned instance will be wrapped with AOP to prevent certain usage.
        Returns:
        a wrapped active Hibernate session
        See Also:
        Trac ticket #73
      • invoke

        public java.lang.Object invoke​(org.aopalliance.intercept.MethodInvocation mi)
                                throws java.lang.Throwable
        Wraps all invocations to Session to prevent certain usages. Note: QueryBuilder may unwrap the session in certain cases.
        Specified by:
        invoke in interface org.aopalliance.intercept.MethodInterceptor
        Throws:
        java.lang.Throwable