Package org.sqlproc.engine.hibernate
Class HibernateSession
- java.lang.Object
-
- org.sqlproc.engine.hibernate.HibernateSession
-
- All Implemented Interfaces:
InvocationHandler
public class HibernateSession extends Object implements InvocationHandler
The Hibernate stack implementation of the SQL Engine session contract. In fact it's a proxy to theSession. It's the first parameter to all primary methods in theSqlQueryEngineandSqlCrudEngine.The implementation is based on the dynamic proxy design pattern provided by the Java API.
The primary contract is the method for the
SqlQueryinstance creation.For more info please see the Tutorials.
- Author:
- Vladimir Hudec
-
-
Field Summary
Fields Modifier and Type Field Description private StringnameThe name of the database related to this session.private static Class[]PROXY_INTERFACESThe contracts implemented by this dynamic proxy.private org.hibernate.SessionsessionThe Hibernate Session, the first level cache and the context for all database operations.
-
Constructor Summary
Constructors Modifier Constructor Description privateHibernateSession(org.hibernate.Session session)Creates a new instance of this dynamic proxy.HibernateSession(org.hibernate.Session session, String name)Creates a new instance of this dynamic proxy.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SqlSessiongenerateProxy(org.hibernate.Session session)The factory method to obtain this dynamic proxy.static SqlSessiongenerateProxy(org.hibernate.Session session, String name)The factory method to obtain this dynamic proxy.static ClassLoadergetProxyClassLoader()Returns the class loader instance.Objectinvoke(Object proxy, Method method, Object[] args)
-
-
-
Field Detail
-
PROXY_INTERFACES
private static final Class[] PROXY_INTERFACES
The contracts implemented by this dynamic proxy.
-
session
private org.hibernate.Session session
The Hibernate Session, the first level cache and the context for all database operations.
-
name
private String name
The name of the database related to this session. It's usage is implementation specific.
-
-
Constructor Detail
-
HibernateSession
private HibernateSession(org.hibernate.Session session)
Creates a new instance of this dynamic proxy.- Parameters:
session- the Hibernate Session instance
-
HibernateSession
public HibernateSession(org.hibernate.Session session, String name)Creates a new instance of this dynamic proxy.- Parameters:
session- the Hibernate Session instancename- the name of the database
-
-
Method Detail
-
invoke
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
- Specified by:
invokein interfaceInvocationHandler- Throws:
Throwable
-
generateProxy
public static SqlSession generateProxy(org.hibernate.Session session)
The factory method to obtain this dynamic proxy.- Parameters:
session- the Hibernate Session instance- Returns:
- the Hibernate stack implementation of the SQL Engine session contract
-
generateProxy
public static SqlSession generateProxy(org.hibernate.Session session, String name)
The factory method to obtain this dynamic proxy.- Parameters:
session- the Hibernate Session instancename- the name of the database- Returns:
- the Hibernate stack implementation of the SQL Engine session contract
-
getProxyClassLoader
public static ClassLoader getProxyClassLoader()
Returns the class loader instance.- Returns:
- the class loader instance
-
-