All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jodd.db.ThreadDbSessionHolder Maven / Gradle / Ivy

Go to download

Jodd DB is efficient and thin database facade; DbOom is convenient database object mapper.

There is a newer version: 6.0.0
Show newest version
// 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