Package com.jk.data.datasource
Class JKSession
java.lang.Object
com.jk.data.datasource.JKSession
This class represents a session for database operations.
- Version:
 - 1.0
 - Author:
 - Dr. Jalal H. Kiswani
 
- 
Constructor Summary
ConstructorsConstructorDescriptionJKSession(JKDataSource connectionManager) This method constructs a newJKSessionusing the provided connection manager.This method constructs a newJKSessionwith a nested session within the provided parent session. - 
Method Summary
Modifier and TypeMethodDescriptionvoidclose()This method closes the session.voidclose(boolean commit) This method closes the session and performs a commit or roll-back operation based on the specified parameter.protected voidcommit(boolean commit) This method sets the commit or roll-back status for this session.This method returns the database connection associated with this session.This method returns the connection manager responsible for managing the database connections.This method returns the parent session if this session is nested within another session.booleanisClosed()This method checks whether the session is closed.booleanisCommit()This method checks whether a commit operation is requested. 
- 
Constructor Details
- 
JKSession
This method constructs a newJKSessionusing the provided connection manager.- Parameters:
 connectionManager- Specifies the connection manager responsible for providing connections.- Throws:
 JKDataAccessException- if there is an error while obtaining a connection.
 - 
JKSession
This method constructs a newJKSessionwith a nested session within the provided parent session.- Parameters:
 parentSession- Specifies the parent session.
 
 - 
 - 
Method Details
- 
close
This method closes the session.If this is a stand-alone session, it will commit or roll-back the transaction based on the session's state and then close the connection.
If this is a nested session, it will return without closing the connection, as the parent session is responsible for that.
- Throws:
 JKDataAccessException- if there is an error during the commit, roll-back, or closing operations.
 - 
close
This method closes the session and performs a commit or roll-back operation based on the specified parameter.- Parameters:
 commit- Indicates whether to commit the transaction (true) or roll-back (false).- Throws:
 JKDataAccessException- if there is an error during the commit, roll-back, or closing operations.
 - 
commit
protected void commit(boolean commit) This method sets the commit or roll-back status for this session.- Parameters:
 commit- Indicates whether to commit the transaction (true) or roll-back (false).
 - 
getConnection
This method returns the database connection associated with this session.- Returns:
 - the database connection.
 
 - 
getConnectionManager
This method returns the connection manager responsible for managing the database connections.If this is a nested session, it will return the parent session's connection manager.
- Returns:
 - the connection manager.
 
 - 
getParentSession
This method returns the parent session if this session is nested within another session.- Returns:
 - the parent session or null if this is a stand-alone session.
 
 - 
isClosed
public boolean isClosed()This method checks whether the session is closed.- Returns:
 - true, if session is closed, false otherwise.
 
 - 
isCommit
public boolean isCommit()This method checks whether a commit operation is requested.- Returns:
 - true, if commit is requested, false otherwise.
 
 
 -