´«ÖDz¥¿Íjavaѧϰ hibernate³õ²½
ÎÒ½ñÌìѧϰÁËÐìÀÏʦ½²µÄhibernate֪ʶ£¬ÎÒ×öÁ˼òµ¥µÄ±Ê¼Ç£º
Ò»¡¢Hibernate
a) Á¬½ÓjavaÓ¦ÓóÌÐòºÍ¹ØϵÐÍÊý¾Ý¿âµÄÖмä¼þ£¬¶ÔJDBC API·â×°£¬¸ºÔð¶ÔÏó³Ö¾Ã»¯
b) λÓڳ־û¯²ã£¬·â×°ËùÓеÄÊý¾Ý·ÃÎÊϸ½Ú£¬Ê¹ÒµÎñÂß¼²ã¸ü¹Ø×¢ÓÚÒµÎñÂß¼£¬Ò»ÖÖORMÓ³É乤¾ß¡£
¶þ¡¢Hibernate API
1.Configuration ÅäÖÃhibernate£¬¸ùÆô¶¯hibernate£¬´´½¨
sessionFactory¶ÔÏó¡£
2.SessionFactory ³õʼ»¯hibernate£¬³äµ±Êý¾ÝÔ´´úÀí£¬´´½¨
session¶ÔÏó¡£Ḭ̈߳²È«µÄ£¬¿É±»¶à¸öÏ̹߳²Ïí¡£ÖØÁ¿¼¶µÄ£¬
ÐèÒªÒ»¸öºÜ´óµÄ»º´æ£¬ÓÃÓÚ´æ·ÅÓÚ¶¨ÒåµÄsqlÓï¾äºÍÓ³ÉäÔªÊý
¾ÝµÈ¡£Óû§»¹¿ÉΪËüÅäÖÃÒ»¸ö»º´æ²å¼þ£¬³ÆΪ¶þ¼¶»º´æ¡£
3.Session ʹÓÃ×î¹ã·º£¬Ò²±»³ÆΪ³Ö¾Ã»¯¹ÜÀíÆ÷£¬ËüÌṩºÍ³Ö¾Ã
»¯Ïà¹ØµÄ²Ù×÷¡£Ôö¡¢É¾¡¢¸Ä¡¢²éµÈ¡£²»ÊÇḬ̈߳²È«µÄ£¬±ÜÃâ¶à
¸öÏ̹߳²Ïí¡£ÇáÁ¿¼¶µÄ£¬´´½¨ºÍÏú»Ù²»ÐèÒªÏûºÄÌ«¶à×ÊÔ´¡£
SessionÖÐÓÐÒ»¸ö»º´æ£¬³ÆΪһ¼¶»º´æ¡£´æ·Åµ±Ç°¹¤×÷µ¥Ôª¼Ó
ÔصĶÔÏó¡£
4.Transaction hibernateÊý¾Ý¿âÊÂÎñ½Ó¿Ú£¬
Ëü¶Ôµ×²ãµÄÊÂÎñ½Ó¿Ú×÷ÁË·â×°.µ×²ãÊÂÎñ½Ó
¿Ú°üÀ¨:
JDBC API
JTA(java Transaction API)
CORBA(common object request Broker architecture)
5.QueryºÍCriteria½Ó¿Ú£º¶¼ÊDzéѯ½Ó¿Ú£¬queryʵÀý
°ü×°ÁËHQL²éѯÓï¾ä£¬hqlÊÇÃæÏò¶ÔÏóµÄ£¬ËûÒýÓÃÀà
Ãû¼°ÀàµÄÊôÐÔÃû£¬¶ø²»ÊDZíÃûºÍ×Ö¶ÎÃû¡£Criteria½Ó
¿ÚÍêÈ«·â×°ÁË»ùÓÚ×Ö·û´®ÐÎʽµÄ²éѯÓï¾ä£¬±È
query½Ó¿Ú¸üÃæÏò¶ÔÏó£¬ËûÉó¤Ö´Ðж¯Ì¬²éѯ¡£
sessoin½Ó¿ÚµÄfind·½·¨Ò²¾ßÓÐÊý¾Ý²éѯ¹¦ÄÜ£¬µ«Ëû
Ö»ÊÇÖ´ÐÐһЩ¼òµ¥µÄhql²éѯÓï¾äµÄ¿ì½Ý·½Ê½£¬Ô¶Ã»
&n
Ïà¹ØÎĵµ£º
ÔÚjavaÖе÷ÓÃ×Ô¼ºµÄc++´úÂëÊÇÒ»¼þ¼òµ¥µÄÊÂÇ飬ÒÔÏÂÀàΪÀý£º
class Prompt {
private native String getLine(String prompt);
public static void main(String args[]) {
Prompt p = new Prompt();
String input = p.getLine("Type a line: ");
&nbs ......
1.Duplicated Code
´úÂëÖظ´¼¸ºõÊÇ×î³£¼ûµÄÒìζÁË¡£ËûÒ²ÊÇRefactoringµÄÖ÷ҪĿ±êÖ®Ò»¡£´úÂëÖظ´ÍùÍùÀ´×ÔÓÚcopy-and-pasteµÄ±à³Ì·ç¸ñ¡£ÓëËûÏà¶ÔÓ¦OAOOÊÇÒ»¸öºÃϵͳµÄÖØÒª±êÖ¾¡£
2.Long method
ËüÊÇ´«Í³½á¹¹»¯µÄ“ÒŶ¾”¡£Ò»¸ö·½·¨Ó¦µ±¾ßÓÐ×ÔÎÒ¶ÀÁ¢µÄÒâͼ£¬²»Òª°Ñ¼¸¸öÒâͼ·ÅÔÚÒ»Æð¡£ ......
°ücommons-net-1.4.1.zip
import org.apache.commons.io.IOUtils;
import org.apache.commons.net.ftp.FTPClient;
import com.eduvideotv.util.Global;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.FileOutputStream;
/**
* Apache commons-net ÊÔÓ ......
×÷ΪJava³ÌÐòÔ±À´Ëµ£¬×îÍ´¿àµÄÊÂÇéĪ¹ýÓÚ¿ÉÒÔÑ¡ÔñµÄ·¶Î§Ì«¹ã£¬¿ÉÒÔ¶ÁµÄÊéÌ«¶à£¬ÍùÍùÈÝÒ×ÎÞËùÊÊ´Ó¡£ÎÒÏë¾ÍÎÒ×Ô¼º¶Á¹ýµÄ¼¼ÊõÊé¼®ÖÐÌôÑ¡³öÀ´Ò»Ð©£¬
°´ÕÕѧϰµÄÏȺó˳Ðò£¬ÍƼö¸ø´ó¼Ò£¬ÌرðÊÇÄÇЩÏë²»¶ÏÌá¸ß×Ô¼º¼¼ÊõˮƽµÄJava³ÌÐòÔ±ÃÇ¡£
Ò»¡¢Java±à³ÌÈëÃÅÀà
¶ÔÓÚûÓÐJava±à³Ì¾ÑéµÄJava³ÌÐòÔ±ÒªÈëÃÅ£¬Ëæ±ã¶ÁʲôÈëÃÅÊé¼®¶¼Ò» ......
BlockingQueueÊÇÒ»¸ö½Ó¿Ú£¬Ëü´ÓQueue¼Ì³Ð¶øÀ´£¬
°üº¬ÁËQueueµÄËùÓй¦ÄÜ£¬²¢ÔÚQueueµÄ»ù´¡ÉÏÌṩÁË2¸öÐµĹ¦ÄÜ£º
1. ¼ìË÷ÔªËØʱµÈ´ý¶ÓÁбäΪ·Ç¿Õ
2. ´æ´¢ÔªËØʱµÈ´ý¿Õ¼ä±äµÃ¿ÉÓá£
ÏÂÃæ³Â¼Ò»Ð©JDKÎĵµÖйØÓÚBlockingQueueµÄ½éÉÜ£º
BlockingQueue ¿ÉÒÔÊÇÏÞ¶¨ÈÝÁ¿µÄ¡£ËüÔ ......