|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.internet2.middleware.grouper.hibernate.HibernateSession
public class HibernateSession
Hibernate helper class. These are kept in a threadlocal to keep transactions going smoothly. If you are in a nested callback situation, and in the same transaction, then the HibernateSession instance will be different, but the underlying Session (from hibernate) object will be the same. To get an instanceof HibernateSession, use the callbackHibernateSession inverse of control method.
Method Summary | |
---|---|
static void |
_internal_closeAllHibernateSessions(java.lang.Throwable t)
close all sessions, but dont throw errors, based on throwable |
static HibernateSession |
_internal_hibernateSession()
get the current hibernate session. |
static HibernateSession |
_internal_hibernateSession(GrouperTransactionType grouperTransactionType)
dont call this method unless you know what you are doing |
static void |
_internal_hibernateSessionCatch(HibernateSession hibernateSession,
java.lang.Throwable e)
catch and handle an exception while working with hibernate session. |
static void |
_internal_hibernateSessionEnd(HibernateSession hibernateSession)
end a hibernate session. |
static boolean |
_internal_hibernateSessionFinally(HibernateSession hibernateSession)
finally block from hibernate session (dont call unless you know what you are doing |
static java.util.Set<HibernateSession> |
_internal_staticSessions()
this is for internal purposes only, dont use this unless you know what you are doing |
static void |
assertNotGrouperReadonly()
make sure not readonly mode |
static ByCriteriaStatic |
byCriteriaStatic()
do a criteria query with proper error handling and in an enclosing transaction (if applicable), or a new one if not |
ByHql |
byHql()
hql action for hibernate |
static ByHqlStatic |
byHqlStatic()
do a hql query with proper error handling and in an enclosing transaction (if applicable), or a new one if not |
ByObject |
byObject()
|
static ByObjectStatic |
byObjectStatic()
do an object operation with proper error handling and in an enclosing transaction (if applicable), or a new one if not |
BySql |
bySql()
hql action for hibernate |
static BySqlStatic |
bySqlStatic()
do a sql query with proper error handling and in an enclosing transaction (if applicable), or a new one if not |
static java.lang.Object |
callbackHibernateSession(GrouperTransactionType grouperTransactionType,
AuditControl auditControl,
HibernateHandler hibernateHandler)
call this to send a callback for the hibernate session object. cant use inverse of control for this since it runs it |
boolean |
commit(GrouperCommitType grouperCommitType)
commit (perhaps, depending on type) |
GrouperTransactionType |
getGrouperTransactionType()
this will return the underlying (if exist) transaction type, and if not, then the one this was constructed with |
org.hibernate.Session |
getSession()
hibernate session object can be accessed by user. |
static void |
internal_assignThreadlocalReadonly(java.lang.Boolean internal_threadlocalReadonly)
|
static java.lang.Boolean |
internal_retrieveThreadlocalReadonly()
|
boolean |
isCachingEnabled()
provide ability to turn off all caching for this session |
boolean |
isNewHibernateSession()
see if this is a new hibernate session |
boolean |
isReadonly()
if this is readonly (based on this declaration or underlying) |
static boolean |
isReadonlyMode()
if readonly by threadlocal or config param |
boolean |
isTransactionActive()
see if tx is active (not committed or rolled back, see Hibernate transaction if there is no transaction, it will return false |
HibernateMisc |
misc()
misc actions for hibernate session |
static void |
resetAllThreadLocals()
call this at the end of requests to make sure everything is cleared out or call periodically... |
boolean |
rollback(GrouperRollbackType grouperRollbackType)
rollback (perhaps, depending on type) |
void |
setCachingEnabled(boolean enabledCaching1)
provide ability to turn off all caching for this session |
static void |
threadLocalReadonlyAssign()
assign that grouper is in readonly mode, make sure to call clear in a finally block |
static void |
threadLocalReadonlyClear()
in finally block call this to not make grouper readonly anymore |
java.lang.String |
toString()
descriptive toString for error handling |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
---|
public ByObject byObject()
public static java.lang.Boolean internal_retrieveThreadlocalReadonly()
public static void internal_assignThreadlocalReadonly(java.lang.Boolean internal_threadlocalReadonly)
internal_threadlocalReadonly
- the internal_threadlocalReadonly to setpublic static boolean isReadonlyMode()
public static void threadLocalReadonlyAssign()
public static void threadLocalReadonlyClear()
public boolean isCachingEnabled()
public void setCachingEnabled(boolean enabledCaching1)
enabledCaching1
- the enabledCaching to setpublic static java.util.Set<HibernateSession> _internal_staticSessions()
public static void resetAllThreadLocals()
public static HibernateSession _internal_hibernateSession()
public static void _internal_closeAllHibernateSessions(java.lang.Throwable t)
t
- public static HibernateSession _internal_hibernateSession(GrouperTransactionType grouperTransactionType) throws GrouperDAOException
grouperTransactionType
-
GrouperDAOException
public static void _internal_hibernateSessionEnd(HibernateSession hibernateSession) throws java.sql.SQLException
hibernateSession
-
java.sql.SQLException
public static void assertNotGrouperReadonly()
public static void _internal_hibernateSessionCatch(HibernateSession hibernateSession, java.lang.Throwable e) throws GrouperDAOException
hibernateSession
- e
-
GrouperDAOException
public static boolean _internal_hibernateSessionFinally(HibernateSession hibernateSession)
hibernateSession
-
public static java.lang.Object callbackHibernateSession(GrouperTransactionType grouperTransactionType, AuditControl auditControl, HibernateHandler hibernateHandler) throws GrouperDAOException
grouperTransactionType
- is enum of how the transaction should work.auditControl
- WILL_AUDIT if caller will create an audit record, WILL_NOT_AUDIT if nothibernateHandler
- will get the callback
GrouperDAOException
- if there is a problem, will preserve runtime exceptions so they are
thrown to the callerpublic static ByHqlStatic byHqlStatic()
public static BySqlStatic bySqlStatic()
public static ByCriteriaStatic byCriteriaStatic()
public static ByObjectStatic byObjectStatic()
public java.lang.String toString()
toString
in class java.lang.Object
public org.hibernate.Session getSession()
public HibernateMisc misc()
public ByHql byHql()
public BySql bySql()
public boolean isNewHibernateSession()
public boolean isReadonly()
public GrouperTransactionType getGrouperTransactionType()
public boolean commit(GrouperCommitType grouperCommitType)
grouperCommitType
- is type of commit
public boolean isTransactionActive()
public boolean rollback(GrouperRollbackType grouperRollbackType)
grouperRollbackType
- is type of rollback
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |