hibernate sql ²Ù×÷
@SuppressWarnings("unchecked")
public List<ZxFunction> selectFunctionParentByUserId(final int userId) {
try {
final String sql = "select * from zx_function where f_id in ( select distinct f.f_parent_id from zx_function f,zx_permission p where p.f_id = f.f_id and p.u_id = ?)";
return (List<ZxFunction>) getHibernateTemplate().execute(new HibernateCallback(){
public Object doInHibernate(Session session)
throws HibernateException, SQLException {
SQLQuery query = session.createSQLQuery(sql).addEntity(ZxFunction.class);
query.setInteger(0, 1);
return query.list();
}});
} catch (Exception e) {
CommonsLog4jUtil.printToConsole(e);
CommonsLog4jUtil.error("FunctionDaoImpl public List<UserFunction> selectFunctionParentByUserId() Error:", e);
return null;
}
}
@SuppressWarnings("unchecked")
public List<UserFunction> selectFunction(final int userId) {
try {
final String sql = "select f.f_id as FId,&q
Ïà¹ØÎĵµ£º
SQL ½Ì³Ì
1£©SQL ¼ò½é
SQL(Structured Query Language£¬½á¹¹²éѯÓïÑÔ)ÊÇÒ»¸ö¹¦ÄÜÇ¿´óµÄÊý¾Ý¿âÓïÑÔ¡£SQLͨ³£Ê¹ÓÃÓÚÊý¾Ý¿âµÄͨѶ¡£ANSI£¨ÃÀ¹ú¹ú¼Ò±ê׼ѧ»á£©Éù³Æ£¬SQLÊǹØÏµÊý¾Ý¿â¹ÜÀíϵͳµÄ±ê×¼ÓïÑÔ¡£SQLÓï¾äͨ³£ÓÃÓÚÍê³ÉһЩÊý¾Ý¿âµÄ²Ù×÷ÈÎÎñ£¬±ÈÈçÔÚÊý¾Ý¿âÖиüÐÂÊý¾Ý£¬»òÕß´ÓÊý¾Ý¿âÖмìË÷Êý¾Ý¡£Ê¹ÓÃSQLµÄ³£¼û¹ØÏµÊý¾Ý¿â¹ ......
SQL°æ£º
alter proc testguo
(
@cityid int,
@cityname nvarchar(100) output
)
as
select @cityname = city_name from BA_Hot_City where cityid = @cityid
select @cityname
go
declare @cityname nvarchar(100)
exec testguo 1,@cityname output
ÁíÒ»°æ£º
ht ......
ÅäÖÃsql server 2000ÒÔÔÊÐíÔ¶³Ì·ÃÎÊÊʺϹÊÕÏ:1. ÓÃsqlÆóÒµ¹ÜÀíÆ÷ÄÜ·ÃÎÊsql server 2000(ÒòΪËüÊDzÉÓÃÃüÃû¹ÜµÀ(named pipes)·½Ê½½øÐз½Ê½),µ«ÓÃado.net ·½Ê½(udp)²»ÄÜ·ÃÎÊ.2. ²ÉÓÃado.net·½Ê½²»ÄÜÔ¶³Ì·ÃÎÊ.¹ÊÕϵĿÉÄÜÔÒòÓÐ:1.sql server 2000ûÓа²×°sql server 2000 sp3a¼°ÒÔÉÏÉý¼¶°ü,»¹Î´ÆôÓò¢¿ª·Å1433¶Ë¿Ú(udp);2 ......