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

📄 dbcommonutils.java

📁 一个用struts tiles的在线影院web系统
💻 JAVA
字号:
package com.blue.web.common.jdbc;

import java.sql.ResultSet;
import java.sql.SQLException;

import com.blue.web.common.model.Section;
import com.blue.web.common.util.SerializeData;
import com.blue.web.common.util.StringUtils;

public class DBCommonUtils {

	/**
	 * 从ResultSet获取Section信息
	 * @param rst
	 * @param item
	 * @throws SQLException
	 */
	public static void populateSectionFormResultSet(ResultSet rst, Section item) throws SQLException {
		try {
			item.setIndexId(rst.getInt("IndexID"));
			item.setParentId(rst.getInt("ParentID"));
			item.setSortOrder(rst.getInt("SortOrder"));

			item.setDateCreated(StringUtils.getDate(rst.getString("DateCreated")));
			item.setLastUpdate(StringUtils.getDate(rst.getString("LastUpdate")));

			item.setActive(rst.getBoolean("IsActive"));
			item.setSearchable(rst.getBoolean("IsSearchable"));
			item.setSearchKey(rst.getString("SearchKeyWords"));

			// Serialize properties data
			item.serialize(populateSerializeDataFormResultSet(rst));

		} catch (SQLException e) {
			e.printStackTrace();
			throw e;
		}
	}
	
	/**
	 * 从ResultSet获取序列化属性数据
	 * @param rst
	 * @return
	 * @throws SQLException
	 */
	public static SerializeData populateSerializeDataFormResultSet(ResultSet rst) throws SQLException {
		SerializeData data = new SerializeData();
		try {
			data.setKeys(rst.getString("PropertyNames"));
			data.setValues(rst.getString("PropertyValues"));
		} catch (SQLException e) {
			throw e; 
		}
		return data;
	}
}

⌨️ 快捷键说明

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