HIbernate调用oracle函数

public String getUnitName(long orgid) {
		java.sql.CallableStatement cStmt = null;
		java.sql.Connection conn = null;
		String returnStr = "";
		try {
			conn = getSession().connection();
			cStmt = conn.prepareCall("{ ?=call get_unitcode_byid_new(?) }");
			cStmt.registerOutParameter(1, Types.VARCHAR);
			cStmt.setLong(2, orgid);
			cStmt.execute();
			returnStr = cStmt.getString(1);
			cStmt.close();
		} catch (SQLException e) {
			System.out.println("---------------error-----------");
		}
		returnStr = getUnitZHName(returnStr);
		//根据code值,去回去对应的中文
		return returnStr;
	}

猜你喜欢

转载自625454856a.iteye.com/blog/1972572
今日推荐