´«ÖDz¥¿Íjavaѧϰ hibernate»º´æ
½ñÌìÎÒѧϰÁËÐìÀÏʦ½²µÄHiberbate»º´æ֪ʶ£¬ÎÒÉÏ¿Î×öÁ˼òµ¥µÄ±Ê¼Ç£º
»º´æÀàÐÍ
Ò».ÊÂÎñ·¶Î§:λÓÚµ±Ç°¹¤×÷µ¥Ôª,²»Äܲ¢·¢·ÃÎÊ
¶þ.½ø³Ì·¶Î§:¶à¸ö¹¤×÷µ¥Ôª¹²Ïí,¿É²¢·¢·ÃÎÊ,¿É´æ´¢ÊµÀý±¾ÉíÒ²¿É´æÉ¢ÁÐÊý¾Ý,È»ºóÔÚ
ÖØÐÂ×é×°
Èý.¼¯Èº·¶Î§:¶à¸ö½ø³ÌºÍÖ÷»ú¼ä·ÃÎÊ,ÍøÂçͨÐÅÊÇÖصã.ÐèÒª½«Êý¾Ý¸´ÖƵ½ËùÓм¯ÈºÖеĽڵã.
»º´æºÍOID:
ÊÂÎñ¼¶»º´æÒ²ÓÃÓÚ¶ÔÏóidµÄʹÓ÷¶Î§,ÊÇÀíÏëµÄ»º´æ
½ø³Ì¼¶»º´æ¿ÉÑ¡ÔñʵÏÖidµÄ½ø³Ì·¶Î§´æ´¢,Ò²ºÍÖ÷¼ü¶ÔÓ¦.²¢·¢¹¤×÷µ¥Ôª²éѯͬһid¶ÔÏóµÄ»°·µ
»ØÏàͬµÄʵÀý.ÔÚ½ø³Ì¼¶»º´æÖеĶÔÏóÒ²¿É°´Öµ·µ»Ø,ÿ¸ö¹¤×÷µ¥ÔªÔÙÖØÐÂ×é×°Ðγɸ±±¾.
Hibernate»º´æ¼Ü¹¹
1¡¢Ò»¼¶»º´æ¼´session.
2¡¢¶þ¼¶»º´æÊÇ¿ÉÅäµÄ²å¼þ,¿ÉÓÃÓÚ½ø³Ì/¼¯Èº·¶Î§»º´æ.ËûÃÇ»º´æ¶¼ÊÇ״̬(°´Öµ·µ»Ø),
¶ø²»ÊÇÕæÕýµÄ³Ö¾Ã»¯¶ÔÏó.¶ÔÓÚÌض¨µÄÊý¾ÝÏîÀ´Ëµ»º´æµÄ²¢·¢²ßÂÔ¶¨ÒåÁËÊÂÎñµÄ
¸ôÀëϸ½Ú.ÿ¸öÀà»òÕßÿ¸ö¼¯ºÏµÄ¶þ¼¶»º´æÊÇ¿ÉÑ¡¿ÉÅäµÄ.ÿ¸ö»º´æ¶¼Ê¹ÓÃÁË×Ô¼º
µÄ»º´æÇøÓò.
3¡¢Hibernate»¹ÊµÏÖÁ˶Բéѯ½á¹û¼¯µÄ»º´æ,ËûºÍ¶þ¼¶»º´æ½ôÃܽáºÏ.¶øÇÒÐèÒª¶îÍâ
µÄÁ½¸öÎïÀí»º´æÇøÓòÀ´ÈÝÄÉ»º´æµÄ²éѯ½á¹ûºÍ×îºó¸üбíµÄʱ¼ä´Á.
ÄÚÖò¢·¢²ßÂÔ
²¢·¢²ßÂÔÊǵ÷½âÈË,¸ºÔðÔÚ»º´æÖмìË÷Êý¾Ý.¶ÔÓÚÌض¨Êý¾ÝÏî,ËûÒ²¶¨ÒåÁËÊÂÎñ¸ôÀëµÄÓïÒå.¶ÔÀà
»ò¼¯ºÏÀ´ËµÊ¹ÓÃÄĸö²¢·¢²ßÂÔÐèÒª×ö³öÅжÏ.
ËĸöÄÚÖõIJ¢·¢²ßÂÔÌåÏÖÁ˵ݼõµÄÊÂÎñ¸ôÀëµÄµÈ¼¶.
1¡¢Transationsal
Ö»ÔÚÊܹܻ·¾³ÖÐʹÓÃ,Èç¹ûÐèÒª¿ÉÒÔÈ·±£ËùÓеÄÊÂÎñ¸ôÀëµ½¿ÉÖظ´¶Á,ºÜÉÙ¸üÐÂÇÒ·ÀÖ¹ÔàÊý
¾ÝÇé¿öϸòßÂÔºÜÖØÒª
2¡¢Read-write
 
Ïà¹ØÎĵµ£º
ÔÚ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 ÊÔÓ ......
ÔÚͨ¶ÁjdkÔ´´úÂëµÄʱºò·¢ÏÖÐí¶àjava·½·¨Ç°¶¼ÓÐnative¹Ø¼ü×ÖÐÞÊΣ¬×îºóµÃÖªnativeÊÇÓëC++ÁªºÏ¿ª·¢µÄʱºòÓõģ¬java×Ô¼º¿ª·¢²»Óá£
ʹÓÃnative¹Ø¼ü×Ö˵Ã÷Õâ¸ö·½·¨ÊÇÔÉúº¯Êý£¬Ò²¾ÍÊÇÕâ¸ö·½·¨ÊÇÓÃC/C++ÓïÑÔʵÏֵģ¬²¢ÇÒ±»±àÒë³ÉÁËDLL£¬ÓÉjavaÈ¥µ÷Óá£ÕâЩº¯Êý ......