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

📄 jdbcusersecuritydao.java

📁 javaBB,一套很不錯的JSP源碼,特共享給大家
💻 JAVA
字号:
package org.javabb.dao.jdbc;

import java.sql.SQLException;
import java.sql.Statement;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.javabb.dao.entity.IUserSecurityDAO;
import org.springframework.jdbc.CannotGetJdbcConnectionException;
import org.springframework.jdbc.core.support.JdbcDaoSupport;

public class JdbcUserSecurityDAO extends JdbcSuper implements
		IUserSecurityDAO {

	private final Log log = LogFactory.getLog(JdbcUserSecurityDAO.class);
	
	/**
	 * @see IUserSecurityDAO#createHashCode(Long, String)
	 */
	public void createHashCode(Long userId, String hashCode) throws Exception {
    	Statement stmt = null;
    	try {
    		log.debug("Creating new userHashCode to userId " + userId);
    		stmt = this.getConnection().createStatement();
			stmt.executeUpdate("UPDATE jbb_users SET user_code='"+ hashCode +"' where id_user=" + userId);
			log.debug("HashCode created");
		} catch (CannotGetJdbcConnectionException e) {
			e.printStackTrace();
		} catch (SQLException e) {
			e.printStackTrace();
	    }finally{
	    	 try {
	    		getConnection().commit();
				stmt.close();
				stmt = null;
			} catch (SQLException e) {}
	    }
		
	}
	
	public void refreshSession(Object obj) {}

}

⌨️ 快捷键说明

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