HibernateµÄÔÉúSQL²éѯ
ÕÛÌÚÁËÎÒ°ëÌìÖÕÓڸ㶨ÁË
²Î¿¼ÁËÕâ¸öÎÄÕ£ºhttp://doc.javanb.com/hibernate-reference-3-2-0-zh/ch16.html
final static String querySql = "select {enterprise.*}, {dict.*} ,{balancd.*}, {weightinfo.*} "
+ "from weight_info weightinfo left outer join t_dict dict on {weightinfo}.productcode={dict}.code join "
+ "t_balancecode {balancd} on {weightinfo}.balancecode={balancd}.balancecode join t_enterprise enterprise "
+ "on {enterprise}.id={balancd}.enterpriseid where "
+ " {weightinfo}.operdate>TO_TIMESTAMP('2009-11-2 04:12:32.0', 'yyyy-mm-dd hh24:mi:ssxff')";
public List loadByQuerySql(final String querySql, final Map params) {
try {
return (List) getHibernateTemplate().execute(
new HibernateCallback() {
public Object doInHibernate(Session session)
throws HibernateException, SQLException {
// Connection c= session.connection();
Query query = session.createSQLQuery(querySql)
.addEntity("weightinfo",WeightInfo.class)
.addEntity("dict",Dict.class)
.addEntity("balancd",BalanceCode.class)
.addEntity("enterprise",Enterprise.class);
// fillParams(query,params);
return query.list();
}
});
} catch (HibernateException e) {
e.printStackTrace();
}
return new ArrayList();
}
Èç¹û²»ÊÇÈ«²¿²ÎÓëµÄtable¶¼·µ»ØÖµ£¬ÄÇô
public Object doInHibern
Ïà¹ØÎĵµ£º
¡ô1¡¢Ê¹ÓÃË÷ÒýÀ´¸ü¿ìµØ±éÀú±í
ȱʡÇé¿öϽ¨Á¢µÄË÷ÒýÊÇ·ÇȺ¼¯Ë÷Òý£¬µ«ÓÐʱËü²¢²»ÊÇ×î¼ÑµÄ¡£ÔÚ·ÇȺ¼¯Ë÷ÒýÏ£¬Êý¾ÝÔÚÎïÀíÉÏËæ»ú´æ·ÅÔÚÊý¾ÝÒ³ÉÏ¡£ºÏÀíµÄË÷ÒýÉè¼ÆÒª½¨Á¢ÔÚ¶Ô¸÷ÖÖ²éѯµÄ·ÖÎöºÍÔ¤²âÉÏ¡£Ò»°ãÀ´Ëµ£º¢Ù.ÓдóÁ¿Öظ´Öµ¡¢ÇÒ¾³£Óз¶Î§²éѯ£¨between, > ,< £¬> =,< =£©ºÍorder by¡¢group by·¢ÉúµÄÁÐ ......
ÔÚSQL UPDATEÓï¾äÖУ¬¶Ô»»Á½¸ö±äÁ¿µÄÖµ£¬²»ÐèÒªÁÙʱ±äÁ¿¡£=ÓÒ²àµÄÖµÔÚÕû¸öUPDATEÓï¾äÖж¼ÊÇÒ»Öµģ»ËùÓеĸüÐÂͬʱ·¢Éú£¬¶ø²»ÊÇÒ»¸ö½Ó×ÅÒ»¸ö·¢Éú¡£
ÀýÈ磺
UPDATE offenceTeam
SET goalShooter=wingAttack,
& ......
1.¼ì²éÄãÊÇ·ñÏÞÖÆÁËÎļþÔö³¤:
ÆóÒµ¹ÜÀíÆ÷--ÓÒ¼üÄãµÄÊý¾Ý¿â--ÊôÐÔ--Êý¾ÝÎļþ--¿´¿´ÓÐûÓÐÉèÖÃÎļþµÄ×î´óÖµ
2.¼ì²éÄãµÄ´ÅÅÌ·ÖÇø¸ñʽ,Èç¹û²»ÊÇNTFS·ÖÇø,Ôò»áÓÐÏÞÖÆ,½«´ÅÅÌ·ÖÇø¸ñʽ¸Ä³ÉNTFS
&n ......
SQLÊý¾Ý»Ö¸´Èí¼þ Log Explorer for SQL Server v4.0
log explorerʹÓõļ¸¸öÎÊÌâ
¡¡¡¡1)¶ÔÊý¾Ý¿â×öÁËÍêÈ« ²îÒì ºÍÈÕÖ¾±¸·Ý
¡¡¡¡±¸·ÝʱѡÓÃÁËɾ³ýÊÂÎñÈÕÖ¾Öв»»î¶¯µÄÌõÄ¿
¡¡¡¡ÔÙÓÃLog explorer´òÊÔͼ¿´ÈÕ־ʱ
¡¡¡¡ÌáʾNo log recorders found that match the filter£¬would you like to view unfiltered ......
¾µäSQLÓï¾ä´óÈ«
ÏÂÁÐÓï¾ä²¿·ÖÊÇMssqlÓï¾ä£¬²»¿ÉÒÔÔÚaccessÖÐʹÓá£
¡¡¡¡SQL·ÖÀࣺ
¡¡¡¡DDL—Êý¾Ý¶¨ÒåÓïÑÔ(CREATE£¬ALTER£¬DROP£¬DECLARE)
¡¡¡¡DML—Êý¾Ý²Ù×ÝÓïÑÔ(SELECT£¬DELETE£¬UPDATE£¬INSERT)
¡¡¡¡DCL—Êý¾Ý¿ØÖÆÓïÑÔ(GRANT£¬REVOKE£¬COMMIT£¬ROLLBACK)
¡¡¡¡Ê×ÏÈ,¼òÒª½éÉÜ»ù´¡Óï¾ä£º
¡¡¡¡1¡¢Ë ......