HibernateÓëSQLµÄÑ¡Ôñ
HibernateÊÇÒ»¿îÓÅÐãµÄORM¹¤¾ß¡£µ«ÊÇÔÚijЩÇé¿öÏÂÄÑÃâ»á¸øÎÒÃǵÄÏîÄ¿´øÀ´Ò»¶¨µÄ¸´ÔÓÐÔ¡£¾ÍËãʹÓÃspring×öÒ»¶¨µÄÊÂÎñ¼ò»¯£¬¸Ä±äµÄÒ²½ö½öÊDZàдµÄʱºò¸ü¼ÓµÄ¼òµ¥¶øÒÑ¡£ÌرðÊÇÔÚ´¦Àí²éѯµÄʱºò£¬hibernateºÍsql±È½ÏÆðÀ´£¬¾ÍËƺõûÓÐÄÇô´óµÄÓÅÊÆÁË¡£ËùÒÔÔںܶàµÄÏîÄ¿ÀïÃæÔÚʹÓÃhibernateºÍspringµÄͬʱ»¹»áʹÓÃibatisµÄsqlmap¡£
ÄÇʲôʱºòʹÓÃhibernate±È½ÏºÏÊÊÄØ?Õâ¸öºÍÎÒÃǵÄÉè¼ÆÓкܴóµÄ¹Øϵ¡£hibernateÊǽâ¾ö¶ÔÏó´æ´¢µÄÎÊÌâµÄ£¬ËµµÄͨË×Ò»µã£¬¾ÍÊǸù¾ÝÎÒÃÇÉè¼ÆµÄ¶ÔÏóϵͳÀ´ÌæÎÒÃÇÉú³ÉsqlÓï¾äµÄ¡£ËùÒÔÈç¹ûÎÒÃǵÄϵͳÊÇÒ»ÖÖ¸´ÔÓµÄÒµÎñϵͳ£¬²¢²»ÐèÒª´óÁ¿µÄÊÂÎñ´¦ÀíºÍ¸´ÔӵIJéѯµÄ»°¡£ÎÒ¾õµÃ³¹µ×µÄʹÓÃhibernateÊDZȽϺõÄÑ¡Ôñ¡£ÕâÑùÎÒÃÇ¿ÉÒÔ¼¯Öо«Á¦ÔÚÒµÎñµÄ´¦ÀíÉÏ¡£µ±È»£¬ÎÒ¾õµÃÕâÖÖÇé¿ö²»Ì«»á³öÏÖ¡£´ó¶àÊýµÄÒµÎñϵͳ¶¼²»»áÓи´ÔӵĶÔÏó½á¹¹¡£ÎÒÔÙ˵µÄͨË×Ò»µã£¬¾Í¿´ÎÒÃǵÄÒµÎñÀïÃ棬ÊÇ×¢ÖØÊý¾Ý´¦Àí»¹ÊÇ×¢ÖØÂß¼·½ÃæµÄ´¦Àí£¬Ç°ÕßÊDz»Ì«ÊʺÏhibernateµÄ¡£ºóÕ߱ȽÏÊʺϡ£Èç¹ûÊÇ»ìºÏµÄϵͳµÄ£¬ÎÒ¾õµÃÁ½Õ߶¼ÊÇÐèÒªµÄ£¬·Ö±ðÍê³É¸÷×ÔµÄÈÎÎñ¡£ÓÐЩÈË¿ÉÄܲ»ÕâÑùÈÏΪ£¬¾õµÃ×Ô¼ºµÄˮƽ×ã¹»¸ß¿ÉÒÔÓÃhibernate½â¾öÒ»ÇеÄÎÊÌ⣬µ«ÊÇÎÒ¾õµÃ£¬ÕâÊÇÒ»ÖÖÆ«¼¤µÄÏë·¨£¬ÒòΪÎÒ¾õµÃûÓÐÒøµ¯£¬Ò²Ã»Óлƽ𴸣¬ÊÀ½çÉÏûÓÐÍòÄܵĶ«Î÷£¬Ñ¡ÔñºÏÊʵŤ¾ßÈ¥½â¾öÏàÓ¦µÄÎÊÌ⣬²ÅÊÇÒ»ÖÖÇÐʵµÄ̬¶È¡£²»ÄÜ×·ÇóÐÎʽÉϵÄÍêÃÀ¡£
Ïà¹ØÎĵµ£º
¶ÔÓÚSQL ServerÊý¾Ý¿â¹ÜÀíÔ±À´½²£¬ÒÑÂúÊÂÎñÈÕÖ¾ÊÇÒ»¸öËöËéµÄ£¬µ«Óֺܳ£¼ûµÄÎÊÌâ¡£ËüÄÜÒý·¢ÊÂÎñµÄÌáÇ°ÖÕÖ¹£¬ÉõÖÁͨ¹ý×èÖ¹ËùÓÐÊÂÎñµÄÒýÈ룬´Ó¶øÒýÆðϵͳµÄ±ÀÀ£¡£¶ÔÓÚÊý¾Ý¿â¹ÜÀíÔ±À´Ëµ£¬¹Ø¼üÊÇÀí½â½«Òª·¢ÉúµÄÇé¿ö£¬ÒÔ±ãËûÃÇ¿ÉÒÔ×·×ÙÒýÆðÎÊÌâµÄÔÒò¡£ ÊÂÎñÈÕÖ¾Ìî³ä·½Ê½
¡¡¡¡ÒÔÏÂÊÇһЩ¿ÉÄÜÒýÆðÊÂÎñÈÕÖ¾ÌîÂúµÄÔÒò£º
¡¡¡¡ÌîÂúµ ......
NOLOCKºÍREADPASTµÄÇø±ð¡£
1.¿ªÆôÒ»¸öÊÂÎñÖ´ÐвåÈëÊý¾ÝµÄ²Ù×÷¡£
BEGIN TRAN t
INSERT INTO Customer
SELECT 'a','a'
2.Ö´ÐÐÒ»Ìõ²éѯÓï¾ä¡£
SELECT * from Customer WITH (NOLOCK)
½á¹ûÖÐÏÔʾ”a”ºÍ”a”¡£µ±1ÖÐÊÂÎñ»Ø¹öºó£¬ÄÇôa½«³ÉΪÔàÊý¾Ý¡£(×¢:1ÖеÄÊÂÎñδÌá½») ¡£NOLOCK±íÃ÷ûÓжÔÊý¾Ý±íÌ ......
SQL Injection with MySQL
±¾ÎÄ×÷Õߣºangel
ÎÄÕÂÐÔÖÊ£ºÔ´´
·¢²¼ÈÕÆÚ£º2004-09-16
±¾ÎÄÒѾ·¢±íÔÚ¡¶ºÚ¿Í·ÀÏß¡·7Ô¿¯£¬×ªÔØÇë×¢Ã÷¡£ÓÉÓÚдÁ˺ܾã¬Ëæ׿¼ÊõµÄ½ø²½£¬±¾ÈËÒ²·¢ÏÖ¸ÃÎÄÀïÓв»ÉÙ´íÎóºÍÂÞàµĵط½¡£Çë¸÷λ¸ßÊÖ¿´Á˲»ÒªÐ¦¡£±¾ÎÄдÓÚ¡¶Advanced SQL Injection with MySQL¡·Ö®Ç°Ò»¸öÔ¡£
ÉùÃ÷
¡¡¡¡±¾ÎĽöÓÃÓÚ½ ......
ÒÔORACLEÊý¾Ý¿âΪÀý£¬ ½«tab±íÖеÄtname×Ö¶Îת³ÉÒÔ¶ººÅ·Ö¸ôµÄ×Ö·û´®
SQLÈçÏ£º
select substr(max(sys_connect_by_path(tname, ',')), 2)
from (
select b.tname, b.t1, lead(b.t1, 1) over (order by b.t1) t2
from (
select a.tname, row_number() over (orde ......
¡¾×ª¡¿Ò»Ð©³£ÓõÄsqlÓï¾ä×Ö·û´®´¦Àí£¬×ªÓÚÕâÀÒÔ·½±ãʹÓÃ
Ò»¡¢×Ö·ûת»»º¯Êý
1¡¢ASCII()
·µ»Ø×Ö·û±í´ïʽ×î×ó¶Ë×Ö·ûµÄASCII ÂëÖµ¡£ÔÚASCII£¨£©º¯ÊýÖУ¬´¿Êý×ÖµÄ×Ö·û´®¿É²»ÓÑ’À¨ÆðÀ´£¬µ«º¬ÆäËü×Ö·ûµÄ×Ö·û´®±ØÐëÓÑ’À¨ÆðÀ´Ê¹Ó㬷ñÔò»á³ö´í¡£
2¡¢CHAR()
½«ASCII Âëת»»Îª×Ö·û¡£Èç¹ûûÓÐÊäÈë0 ~ ......