/** * Returns current thread session or <code>null</code> if no session is assigned * to a thread. */ public static DbSession getCurrentSession() { return ThreadDbSessionHolder.get(); }
/** * Closes current session and remove the association from current thread. * @see jodd.db.DbSession#closeSession() */ @Override public void closeSession() { ThreadDbSessionHolder.remove(); super.closeSession(); }
/** * Creates new db session and assigns it to the current thread. * Closes already assigned session, if any exist. * @param connectionProvider connection provider */ public DbThreadSession(final ConnectionProvider connectionProvider) { super(connectionProvider); final DbSession session = ThreadDbSessionHolder.get(); if (session != null) { session.closeSession(); } ThreadDbSessionHolder.set(this); }
/** * Returns existing thread session, or new one if already not exist. If session doesn't exist, it will be created * using default connection provider. */ public static DbThreadSession getThreadSession() { DbThreadSession session = (DbThreadSession) ThreadDbSessionHolder.get(); if (session == null) { session = new DbThreadSession(); } return session; }
/** * Creates new db session and assigns it to the current thread. * Closes already assigned session, if any exist. * @param connectionProvider connection provider */ public DbThreadSession(ConnectionProvider connectionProvider) { super(connectionProvider); DbSession session = ThreadDbSessionHolder.get(); if (session != null) { session.closeSession(); } ThreadDbSessionHolder.set(this); }
/** * Closes current session and remove the association from current thread. * @see jodd.db.DbSession#closeSession() */ @Override public void closeSession() { ThreadDbSessionHolder.remove(); super.closeSession(); }
/** * Closes thread session. */ public static void closeThreadSession() { DbThreadSession session = (DbThreadSession) ThreadDbSessionHolder.get(); if (session != null) { session.closeSession(); } }
/** * Creates new db session and assigns it to the current thread. * Closes already assigned session, if any exist. * @param connectionProvider connection provider */ public DbThreadSession(final ConnectionProvider connectionProvider) { super(connectionProvider); final DbSession session = ThreadDbSessionHolder.get(); if (session != null) { session.closeSession(); } ThreadDbSessionHolder.set(this); }
/** * Closes current session and remove the association from current thread. * @see jodd.db.DbSession#closeSession() */ @Override public void closeSession() { ThreadDbSessionHolder.remove(); super.closeSession(); }
/** * {@inheritDoc} */ @Override public DbSession getDbSession() { log.debug("Requesting thread session"); final DbSession session = ThreadDbSessionHolder.get(); if (session == null) { throw new DbSqlException( "No DbSession associated with current thread." + "It seems that ThreadDbSessionHolder is not used."); } return session; }
/** * Returns current thread session or <code>null</code> if no session is assigned * to a thread. */ public static DbSession getCurrentSession() { return ThreadDbSessionHolder.get(); }
/** * Returns current thread session or <code>null</code> if no session is assigned * to a thread. */ public static DbSession getCurrentSession() { return ThreadDbSessionHolder.get(); }
DbThreadSession dbThreadSession = (DbThreadSession) ThreadDbSessionHolder.get(); assertNotNull(dbThreadSession); assertFalse(dbThreadSession.isSessionClosed());
/** * Returns existing thread session, or new one if already not exist. If session doesn't exist, it will be created * using default connection provider. */ public static DbThreadSession getThreadSession() { DbThreadSession session = (DbThreadSession) ThreadDbSessionHolder.get(); if (session == null) { session = new DbThreadSession(); } return session; }
/** * Returns existing thread session, or new one if already not exist. If session doesn't exist, it will be created * using default connection provider. */ public static DbThreadSession getThreadSession() { DbThreadSession session = (DbThreadSession) ThreadDbSessionHolder.get(); if (session == null) { session = new DbThreadSession(); } return session; }
/** * Closes thread session. */ public static void closeThreadSession() { DbThreadSession session = (DbThreadSession) ThreadDbSessionHolder.get(); if (session != null) { session.closeSession(); } }
/** * Closes thread session. */ public static void closeThreadSession() { DbThreadSession session = (DbThreadSession) ThreadDbSessionHolder.get(); if (session != null) { session.closeSession(); } }
/** * {@inheritDoc} */ @Override public DbSession getDbSession() { log.debug("Requesting thread session"); final DbSession session = ThreadDbSessionHolder.get(); if (session == null) { throw new DbSqlException( "No DbSession associated with current thread." + "It seems that ThreadDbSessionHolder is not used."); } return session; }
/** * Closes db session. */ public static void closeThreadDbSession() { if (log.isDebugEnabled()) { log.debug("Closing thread session"); } DbSession session = ThreadDbSessionHolder.get(); if (session != null) { session.closeSession(); } } }