⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 abstracttransaction.java

📁 jdo开发实例,一个功能全面的oa系统
💻 JAVA
字号:
/**
* <p>Title: abstract Transaction</p>
* <p>Description: abstract Transaction for tran styled  operations, atomic operations</p>
* <p>Copyright: Copyright (c) 2002-2003</p>
* <p>Company: RealMap</p>
* @author: Mulder
* @version 2003a
*/


package com.gzrealmap.oa.db;
import com.gzrealmap.lib.sys.*;
import java.util.Hashtable;
import java.sql.*;
import com.gzrealmap.lib.jdbc.JDBCUtil;
public abstract class abstractTransaction implements transaction
{
	private  JDBCUtil db;
	protected Hashtable parameters = new Hashtable();
	//public AccessControl theAccessControl;


	/**
	@roseuid 3DD5D0C303CB
	*/
	public abstractTransaction() throws Exception
	{
		db = JDBCUtil.getInstance();
		db.connect();
		db.setAutoCommit(false);//setAutoCommit false
	}





	/**
	@roseuid 3DD59B220362
	*/
	public void beginTran()   throws Exception
	{
		return ;
	}

	/**
	@roseuid 3DD59B3D011C
	*/
	public void commitTran()  throws Exception
	{
		db.commit();
		return ;
	}


	/**
	@roseuid 3DD59B430247
	*/
	public void rollBack() throws Exception
	{
		db.rollback();
		return ;
	}


	/**
	@roseuid 3DD59C07019F
	*/
	abstract public void performAction() throws Exception;

	/**
	**	Set the specific parameters here, provide the performAction() parameters with a HashTable.
	** It is only suitable for transaction type parameters(not too many), for constructing a huge
	** HashTable is resource consuming
	@param parameters
	@roseuid 3DD59C1E0256
	*/
	public void setParameters(Hashtable parameters) throws Exception
	{
		this.parameters = parameters;
		return ;
	}


	/**
	直接进行SQL操作,并提交
	@param sql
	@roseuid 3DD5C2A8010B
	*/
	public void performAction(String sql) throws Exception
	{
		this.execute(sql) ;
		db.commit();
		return ;
	}

	/**
	直接进行SQL操作
	@param sql
	@roseuid 3DD5C2A8010B
	*/
	protected void execute(String sql) throws Exception
	{
		db.execute(sql);
	}
	public ResultSet getResult(String sql)  throws Exception
	{
		return db.query( sql);
	}
	/**
	@param userName
	@return java.lang.Boolean
	@roseuid 3DD5C63100E5
	*/
	public Boolean checkPermission(String userName) throws Exception
	{
		return null;
	}

	/**
	**	返回特定名称的参数值
	** @param 参数名称
	** @return 参数值
	*/
	public String getString(String paraname)
	{
		return (String)parameters.get(paraname);
	}
}




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -