📄 connectionfactory.java
字号:
package org.speedframework.conneciton;
import java.sql.Connection;
import org.speedframework.configure.ConnConfigure;
import java.sql.SQLException;
import org.speedframework.exception.SpeedException;
/**
* <p>Title: SpeedFrameworkWork持久层框架</p>
*
* <p>Description:连接类 </p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: SpeedFrameworkWork team</p>
* @author 李志峰 电话:13824431576 程伟杰 电话:
* @version 1.0
*/
public final class ConnectionFactory {
private static ConnConfigure conf = new ConnConfigure();
private static Connection con;
/**
* 提取连接(指定id)
*
* @param commit boolean
* @param id String
* @throws SpeedException
* @return Connection
*/
public static Connection getConnection(boolean commit, String id) throws
SpeedException {
con = conf.getConnection(id);
try {
con.setAutoCommit(commit);
}
catch (SQLException ex) {
throw new SpeedException(ex);
}
return con;
}
/**
* 提取连接
*
* @param commit boolean
* @throws SpeedException
* @return Connection
*/
public static Connection getConnection(boolean commit) throws SpeedException {
try {
con = conf.getConnection();
con.setAutoCommit(commit);
}
catch (SQLException ex) {
throw new SpeedException(ex);
}
return con;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -