
jodd.db.ThreadDbSessionHolder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jodd-db Show documentation
Show all versions of jodd-db Show documentation
Jodd DB is efficient and thin database facade; DbOom is convenient database object mapper.
// Copyright (c) 2003-2012, Jodd Team (jodd.org). All Rights Reserved.
package jodd.db;
/**
* {@link DbSession} thread storage.
*/
public class ThreadDbSessionHolder {
private static final ThreadLocal DB_SESSION = new ThreadLocal();
/**
* Returns current thread db session.
*/
public static DbSession get() {
return DB_SESSION.get();
}
/**
* Sets current db session.
*/
public static void set(DbSession dbSession) {
DB_SESSION.set(dbSession);
}
/**
* Removes current db session from the thread and returns it.
*/
public static void remove() {
DB_SESSION.set(null);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy