jiapeng 8 anos atrás
pai
commit
a51fc7b9a4

+ 1 - 1
jfwAptWeb/src/main/java/org/jfw/apt/web/handlers/buildParam/RequestParamHandler.java

56
		private void initTargetType(MethodParamEntry mpe) throws AptException {
56
		private void initTargetType(MethodParamEntry mpe) throws AptException {
57
			this.mpe = mpe;
57
			this.mpe = mpe;
58
			TypeName tn = annotation.getRealClass();
58
			TypeName tn = annotation.getRealClass();
59
			if (TypeName.OBJECT.equals(tn))
59
			if (null== tn || TypeName.OBJECT.equals(tn))
60
				tn = TypeName.get(this.mpe.getRef().asType());
60
				tn = TypeName.get(this.mpe.getRef().asType());
61
61
62
			if (!tn.getClass().equals(ClassName.class)) {
62
			if (!tn.getClass().equals(ClassName.class)) {

+ 7 - 0
jfwUtil/src/main/java/org/jfw/util/jdbc/JdbcTask.java

1
package org.jfw.util.jdbc;
2

3
import java.sql.SQLException;
4

5
public interface JdbcTask {
6
	void exec() throws SQLException;
7
}

+ 29 - 0
jfwUtil/src/main/java/org/jfw/util/jdbc/JdbcUtil.java

24
	private JdbcUtil() {
24
	private JdbcUtil() {
25
	}
25
	}
26
26
27
	public  static void executeAutoCommit(Connection con,JdbcTask task)throws SQLException{
28
		boolean old = con.getAutoCommit();
29
		try{
30
			con.setAutoCommit(false);
31
			task.exec();
32
			con.commit();
33
		}catch(SQLException e){
34
			rollback(con);
35
			throw e;
36
		}finally{
37
			con.setAutoCommit(old);
38
		}
39
	}
40
	public  static void executeAutoClose(Connection con,JdbcTask task,boolean commit)throws SQLException{
41
		boolean old = con.getAutoCommit();
42
		try{
43
		if(commit) 	con.setAutoCommit(false);
44
			task.exec();
45
		if(commit)	con.commit();
46
		}catch(SQLException e){
47
			rollback(con);
48
			throw e;
49
		}finally{
50
			if(commit)con.setAutoCommit(old);
51
			close(con);
52
		}
53
	}
54
	
55
	
27
	public static void close(Connection con) {
56
	public static void close(Connection con) {
28
		try {
57
		try {
29
			con.close();
58
			con.close();