锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲综合一区二区三区四区五区 ,亚洲av成人无码网站…,久久精品夜色噜噜亚洲A∨http://www.tkk7.com/gumingcn/category/44176.html璺笂鏈夋儕鎱岋紝璺笂鏈夌悊鎯?/description>zh-cnSun, 27 Mar 2011 13:56:38 GMTSun, 27 Mar 2011 13:56:38 GMT60Hibernate Annotation 絎旇http://www.tkk7.com/gumingcn/archive/2010/10/12/334667.html闃鍏?/dc:creator>闃鍏?/author>Tue, 12 Oct 2010 08:52:00 GMThttp://www.tkk7.com/gumingcn/archive/2010/10/12/334667.htmlhttp://www.tkk7.com/gumingcn/comments/334667.htmlhttp://www.tkk7.com/gumingcn/archive/2010/10/12/334667.html#Feedback0http://www.tkk7.com/gumingcn/comments/commentRss/334667.htmlhttp://www.tkk7.com/gumingcn/services/trackbacks/334667.html 1.@Entity 鏍囪瘑瀹炰綋
2.@Table (name = "tableName") //鎸囧畾鐗╃悊琛?br />
@Table(name="tbl_sky",
    uniqueConstraints = {@UniqueConstraint(columnNames={"month", "day"})}//鍞竴鎬х害鏉?br /> )

3.@Embeddable 琚0鏄庣殑綾誨彲浠ュ祵鍏ュ叾浠栧疄浣撲腑
public class Address {
   private String street1;//persistent
   public String getStreet1() { return street1; }
   public void setStreet1() { this.street1 = street1; }
   private hashCode; //not persistent
}
@Embedded 鍦ㄥ疄浣撲腑宓屽叆涓涓被鍨嬶細(xì)甯哥敤鐨勫儚鍚嶅瓧錛屽湴鍧涔嬬被鐨?br /> 鍙︼紝浣跨敤@AttributeOverrides鏍囪瘑瑕嗙洊鍘熺被涓殑灞炴у彇鍊鹼紝鍥犱負(fù)鍘熷疄浣撳彲鑳藉紩鐢ㄧ殑鏄叾浠栧瓧孌點?br />  @Embedded
    @AttributeOverrides( {
            @AttributeOverride(name="iso2", column = @Column(name="bornIso2") ),
            @AttributeOverride(name="name", column = @Column(name="bornCountryName") )
    } )
Country bornIn;

渚嬪瓙錛?br /> @Entity

class User {
  @EmbeddedId
  @AttributeOverride(name="firstName", column=@Column(name="fld_firstname")
  UserId id;
  Integer age;
}
@Embeddable
class UserId implements Serializable {//姝ゅSerializable鏄繀欏葷殑
  String firstName;
  String lastName;
}

4.@Access(AcessType.PROPERTY)
蹇呴』瀹氫箟getter/setter鏂規(guī)硶鎵嶈兘瀹炵幇鎸佷箙鍖?br /> 榪樻湁鍙︿竴縐嶅彇鍊鹼細(xì)AcessType.FILED,鍙互涓嶅畾涔塯etter/setter鏂規(guī)硶錛屼篃鑳藉疄鐜版寔涔呭寲
姝nnotation涔熷彲浠ュ畾涔夊瓧孌點?br />
5.涓婚敭錛?br />    A.鍗曢敭
    @Id
    @GeneratedValue (generator = "identity")
    @GenericGenerator (name = "identity", strategy = "identity")
    鎴栬?br />     @javax.persistence.SequenceGenerator(
    name="SEQ_STORE",
    sequenceName="my_sequence")
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="SEQ_STORE")
    鍏朵腑錛?br />      strategy鍙栧間負(fù):
     AUTO - either identity column, sequence or table depending on the underlying DB
     TABLE - table holding the id
     IDENTITY - identity column
     SEQUENCE - sequence
   B.澶嶅悎緇勯敭
    @Entity
 class Customer {
  @EmbeddedId CustomerId id;
  boolean preferredCustomer;
  @MapsId("userId")//user.id涓巆ustomerId.userId 浣跨敤鐩稿悓鐨勫?br />   @JoinColumns({
    @JoinColumn(name="userfirstname_fk", referencedColumnName="firstName"),
    @JoinColumn(name="userlastname_fk", referencedColumnName="lastName")
  })
  @OneToOne User user;
}


@Embeddable
class CustomerId implements Serializable {
  UserId userId;
  String customerNumber;
}


@Entity
class User {
  @EmbeddedId UserId id;
  Integer age;
}

@Embeddable
class UserId implements Serializable {
  String firstName;
  String lastName;
}
     

6.瀛楁璁劇疆錛?br /> @Column(
    name="columnName";
    boolean un(2)ique() default false;
    boolean nu(3)llable() default true;
    boolean in(4)sertable() default true;
    boolean up(5)datable() default true;
    String col(6)umnDefinition() default "";
    String tab(7)le() default "";
    int length(8)() default 255;
    int precis(9)ion() default 0; // decimal precision
    int scale((10)) default 0; // decimal scale
@Transient 闈炴寔涔呭寲瀛楁
@Basic 鎸佷箙鍖栧瓧孌?br /> @Basic(fetch = FetchType.LAZY) basic 鐢ㄤ簬瀹氫箟property鐨刦etch灞炴?br /> @Enumerated(EnumType.STRING) 鏍囪瘑enum persisted as String in database
@Lob  blob clob瀛楁
@Formula("obj_length * obj_height * obj_width")//鑷畾涔夎緭鍑?br /> public long getObjectVolume()

7.Mapping鍏崇郴
A.涓瀵瑰鎴栬呬竴瀵逛竴錛?br />  @OneToOne(cascade = CascadeType.ALL) 涓瀵逛竴鍏崇郴錛岀駭鑱斿叧緋諱負(fù)all
 @PrimaryKeyJoinColumn鎴栬?br />  鎸囧畾鍏寵仈澶栭敭
 @JoinColumn(name="passport_fk")
 Passport passport錛?br />  涓瀵逛竴鐨勫彟涓绔彧闇@OneToOne(mappedBy = "passport")錛宲assport涓哄墠涓涓疄浣撳0鏄庣殑鍚嶅瓧


@OneToMany(fetch = FetchType.LAZY , mappedBy = "adProduct")
@Cascade(value = {CascadeType.ALL,CascadeType.DELETE_ORPHAN})

@OrderBy(value = "id")  //鎺掑簭
B.澶氬涓錛?br />     @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name="adPosition_id",nullable=false)   
   

8.Fetch and Lazy
AnnotationsLazyFetch
@[One|Many]ToOne](fetch=FetchType.LAZY) @LazyToOne(PROXY) @Fetch(SELECT)
@[One|Many]ToOne](fetch=FetchType.EAGER) @LazyToOne(FALSE) @Fetch(JOIN)
@ManyTo[One|Many](fetch=FetchType.LAZY) @LazyCollection(TRUE) @Fetch(SELECT)
@ManyTo[One|Many](fetch=FetchType.EAGER) @LazyCollection(FALSE) @Fetch(JOIN)

9.Cascade

10.緙撳瓨

緙撳瓨鐨勬敞閲婂啓娉曞涓嬶紝鍔犲湪Entity鐨刯ava綾諱笂錛?br />

@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)

緙撳瓨鐨勬柟寮忔湁鍥涚錛屽垎鍒負(fù)錛?/p>

  • CacheConcurrencyStrategy.NONE
  • CacheConcurrencyStrategy.READ_ONLY錛屽彧璇繪ā寮忥紝鍦ㄦ妯″紡涓嬶紝濡傛灉瀵規(guī)暟鎹繘琛屾洿鏂版搷浣滐紝浼?xì)鏈夊紓甯稿Q?
  • CacheConcurrencyStrategy.READ_WRITE錛岃鍐欐ā寮忓湪鏇存柊緙撳瓨鐨勬椂鍊欎細(xì)鎶婄紦瀛橀噷闈㈢殑鏁版嵁鎹㈡垚涓涓攣錛屽叾瀹冧簨鍔″鏋滃幓鍙栫浉搴旂殑緙撳瓨鏁版嵁錛屽彂鐜拌閿佷簡鐩存帴灝卞幓鏁版嵁搴撴煡璇紱
  • CacheConcurrencyStrategy.NONSTRICT_READ_WRITE錛屼笉涓ユ牸鐨勮鍐欐ā寮忓垯涓嶄細(xì)瀵圭紦瀛樻暟鎹姞閿侊紱
  • CacheConcurrencyStrategy.TRANSACTIONAL錛屼簨鍔℃ā寮忔寚緙撳瓨鏀寔浜嬪姟錛屽綋浜嬪姟鍥炴粴鏃訛紝緙撳瓨涔熻兘鍥炴粴錛屽彧鏀寔JTA鐜銆?


11.No-Annotation 瀛楁錛?br />
      If the property is of a single type, it is mapped as @Basic

      Otherwise, if the type of the property is annotated as @Embeddable, it is mapped as @Embedded

      Otherwise, if the type of the property is Serializable, it is mapped as @Basic in a column holding the object in its serialized version

      Otherwise, if the type of the property is java.sql.Clob or java.sql.Blob, it is mapped as @Lob with the appropriate LobType


]]>
Rule Engine涔婦roolshttp://www.tkk7.com/gumingcn/archive/2010/09/25/332860.html闃鍏?/dc:creator>闃鍏?/author>Sat, 25 Sep 2010 09:48:00 GMThttp://www.tkk7.com/gumingcn/archive/2010/09/25/332860.htmlhttp://www.tkk7.com/gumingcn/comments/332860.htmlhttp://www.tkk7.com/gumingcn/archive/2010/09/25/332860.html#Feedback0http://www.tkk7.com/gumingcn/comments/commentRss/332860.htmlhttp://www.tkk7.com/gumingcn/services/trackbacks/332860.html
Drools 鏄敤 Java 璇█緙栧啓鐨勫紑鏀炬簮鐮佽鍒欏紩鎿庛侱rools 鍏佽浣跨敤澹版槑鏂瑰紡琛ㄨ揪涓氬姟閫昏緫銆傚彲浠ヤ嬌鐢ㄩ潪 XML 鐨勬湰鍦拌璦緙栧啓瑙勫垯錛堣繖鐐瑰緢閲嶈錛屾湰浜轟箣鍓嶆浘鐢ㄨ繃鑷繁鍏徃鐨勪竴濂椾笟鍔¤鍒欑粍浠訛紝鏃犺鏄紪鍐欒繕鏄皟璇曢兘寰堥夯鐑︼級錛屼粠鑰屼究浜庡涔?fàn)鍜岀悊瑙c傚茍涓旓紝榪樺彲浠ュ皢 Java 浠g爜鐩存帴宓屽叆鍒拌鍒欐枃浠朵腑錛屼嬌Drools 鏇村姞鍚稿紩浜恒傜畝鍗曠殑姒傛嫭錛屽氨鏄畝鍗曚嬌鐢紝鏄撲簬鐞嗚В銆傝屼笖瀹冩槸鍏嶈垂鐨勩?br />
1.rule鏂囦歡錛?/strong>
rule "rule name"  
    no-loop
    when
      customer : Customer( state == CustomerState.UNCENSORED )     
    then
        customer.setState(CustomerState.AUDITING);
        CustomerTask task=new CustomerTask();
        Post law=userService.getPostByPostCode(Constants.PostCode.ROOT_LAW);
        task.setAuditorPost(law);
        task.setEntityState(CustomerState.AUDITING);
        task.setEntityId(customer.getId());
        task.setEntityCode(String.valueOf(customer.getId()));
        task.setEntityType(Customer.class.getSimpleName());
        task.setTitle(customer.getName()+" test");
        taskService.assignmentTask(task);
        logger.info("CustomerTask Submit auditorTitle:" + task.getAuditorTitle());
end

榪欓噷闈㈡湁涓姸鎬佺殑鏉′歡鍒ゆ柇state == CustomerState.UNCENSORED 錛宼hen 鍏抽敭瀛楀悗闈㈢殑渚挎槸絎﹀悎鏉′歡鐨勫鐞嗛昏緫錛屽彧瑕佹槸java紼嬪害閮藉彲浠ョ湅鎳傦紝姣攛ml綾葷殑rule鏂囦歡濂芥噦浜嗚澶氥?br />
鎺ヤ笅鏉?br /> 璇硶璇存槑錛?/strong>


鏂囦歡澶撮儴鍒嗭細(xì)
package drools.java.demo;瀹氫箟鍖呭悕,絳夊悓浜庡懡鍚嶇┖闂?br /> import drools.java.demo.Machine;瀵煎叆java綾?br /> global java.util.List myGlobalList;姝ゅ叧閿瓧璁╄鍒欏紩鎿庣煡閬擄紝myGlobalList瀵硅薄搴旇鍙互浠庤鍒欎腑璁塊棶.
function:
綾諱技浜庡叕鐢ㄦ柟娉曠殑鎶借薄錛屽涓嬪畾涔夊悗錛屽悇涓悓涓鏂囦歡涓嬬殑rule閮藉彲浠ヤ嬌鐢?br /> function void setTestsDueTime(Machine machine, int numberOfDays) {
    setDueTime(machine, Calendar.DATE, numberOfDays);
}
rule錛氬畾涔変簡涓涓鍒?br />

rule "<name>"
<attribute>*
when
<conditional element>*
then
<action>*
end




<name> 鍗硆ule鐨勫悕瀛楁爣璇?br />
<attribute>:

甯哥敤鐨勫睘鎬э細(xì)
no-loop 錛歵rue 鏉′歡緇撴灉鏇存敼鍚庯紝淇敼姝ゆ潯浠朵笖瀹氫箟涓簄o-loop:true鐨勮鍒欎笉浼?xì)鍐嶉噸鏂版墽琛屻?br />
lock-on-active錛歵rue 鍙互鐪嬩綔鏄痭o-loop鐨勫姞寮虹増錛屽綋鏉′歡緇撴灉鏇存敼鍚庯紝涓嶄絾淇敼姝ゆ潯浠剁殑瑙勫垯涓嶄細(xì)閲嶆柊鎵ц錛屾枃浠朵腑鐨勪換浣曡鍒欙紙鍏?active-lock 灞炴ц璁句負(fù) true錛変笉浼?xì)閲嶆柊鎵ц銆?/pre>
salience錛?00 浣跨敤瀹冨彲浠ヨ瑙勫垯鎵ц寮曟搸鐭ラ亾搴旇鍚姩瑙勫垯鐨勭粨鏋滆鍙ョ殑欏哄簭銆傚叿鏈夋渶楂樻樉钁楀肩殑瑙勫垯鐨勭粨鏋滆鍙ラ鍏堟墽琛岋紱鍏鋒湁絎簩楂樻樉钁楀肩殑瑙勫垯鐨勭粨鏋滆鍙ョ浜屾墽琛岋紝渚濇綾繪帹銆傚綋鎮(zhèn)ㄩ渶瑕佽瑙勫垯鎸夐瀹氫箟欏哄簭鍚姩鏃訛紝榪欎竴鐐歸潪甯擱噸瑕併?br />

鍏朵粬灞炴х殑瑙i噴璇瘋http://downloads.jboss.com/drools/docs/5.1.1.34858.FINAL/drools-expert/html_single/index.html#d0e2607

when:濉啓鏉′歡鐨勫湴鏂癸紝姣斿錛?br />
Cheese( type == "stilton", price < 10, age == "mature" )鎴?br />

Cheese( type == "stilton" && price < 10, age == "mature" )

then:涓氬姟瑙勫垯鐨勫湴鏂癸紝鐣ャ?br />
2.鐢ㄦ硶

瑙勫垯鏂囦歡瀹氫箟濂藉悗錛屽氨璇ユ槸鎬庝箞浣跨敤瀹冧簡


濡備笂鍥撅紝file rule瀹氫箟濂藉悗錛屽氨璇ユ槸濡備綍浣跨敤瀹冧簡銆傛渶閲嶈鐨勪袱涓被RuleBase鍜學(xué)orkingMemory

涓嬮潰鏄竴涓猠xample:
public class RulesEngine {
    private RuleBase rules;
    private boolean debug = false;
    public RulesEngine(String rulesFile) throws RulesEngineException {
        super();
        try {
            // Read in the rules source file
            Reader source = new InputStreamReader(RulesEngine.class
                    .getResourceAsStream("../../rules/" + rulesFile));

            // Use package builder to build up a rule package
            PackageBuilder builder = new PackageBuilder();

            // This will parse and compile in one step
            builder.addPackageFromDrl(source);

            // Get the compiled package
            Package pkg = builder.getPackage();

            // Add the package to a rulebase (deploy the rule package).
            rules = RuleBaseFactory.newRuleBase();
            rules.addPackage(pkg);

        } catch (Exception e) {
            throw new RulesEngineException(
                    "Could not load/compile rules file: " + rulesFile, e);
        }
    }
    public RulesEngine(String rulesFile, boolean debug)
            throws RulesEngineException {
        this(rulesFile);
        this.debug = debug;
    }
    public void executeRules(WorkingEnvironmentCallback callback) {
        WorkingMemory workingMemory = rules.newStatefulSession();
        if (debug) {
            workingMemory
                    .addEventListener(new DebugWorkingMemoryEventListener());
        }
        callback.initEnvironment(workingMemory);
        workingMemory.fireAllRules();
    }
}
RulesEngine鏋勯犳柟娉曟紨紺轟簡濡備綍鍘昏鍏ヤ竴涓猺ule鏂囦歡,騫舵瀯寤轟簡涓涓猂uleBase瀵硅薄(RuleBase 鏄竴涓寘鍚簡rule鏂囦歡鐨勬墍鏈夎鍒欑殑闆嗗悎)
executeRules鏂規(guī)硶瀹氫箟浜嗗浣曚嬌鐢ㄨ鍒欐枃浠朵腑瀹氫箟鐨勯偅浜涘唴瀹癸紝鐢≧uleBase鏋勫緩涓涓猈orkingMemory瀵硅薄錛屽啀鎵цfireAllRules()鏂規(guī)硶銆?br /> WorkingMemory 浠h〃浜嗕笌rulebase閾炬帴鐨剆ession浼?xì)璇濆Q屼篃鍙互鐪嬩綔鏄伐浣滃唴瀛樼┖闂淬傚鏋滀綘瑕佸悜鍐呭瓨涓彃鍏ヤ竴涓璞″彲浠ヨ皟鐢╥nsert()鏂規(guī)硶,鍚岀悊錛屾洿鏂頒竴涓璞′嬌鐢╱pdate()鏂規(guī)硶銆俉orkingMemory榪樻湁涓涓猻etGlobal()鏂規(guī)硶錛岀敤鏉ヨ緗鍒欏唴鍙互寮曠敤鐨勫璞?鐩稿綋浜庤鍒欑殑鍏ㄥ眬鍙橀噺)銆?br />
3.灝忔妧宸?/strong>

  鍙互涓嬈℃妸鎵鏈夌殑rule鏂囦歡閮借澆鍏ュ唴瀛樹腑瀛樻斁錛岃繖鏍峰氨涓嶇敤姣忔鎵ц閮借鍙栨枃浠躲?br />   濡傛灉瑙勫垯鏂囦歡琚慨鏀癸紝涔熷彲浠ョ敤榪囦竴涓柟娉曟潵鍒ゆ柇鏄惁闇瑕侀噸鏂拌澆鍏ule鏂囦歡
  姣斿錛氭牴鎹枃浠剁殑鏈鍚庝慨鏀規(guī)椂闂達(dá)紝涓庡唴瀛樹腑瀵瑰簲瀵硅薄鐨勬椂闂村仛姣旇緝
public boolean hasChange(List<RuleFile> ruleFileList){
        for(RuleFile ruleFile:ruleFileList){
            if(!ruleFile.getLastModifyTime().equals(ruleFileMap.get(ruleFile.getFileName()).getLastModifyTime())){
                return true;
            }
        }
        return false;
    }

娉細(xì)鍏蜂綋鐨刪elloWorld 璇瘋http://www.ibm.com/developerworks/cn/java/j-drools/#listing12錛屾瘮鎴戣寰楀ソ澶氫簡銆?br />

]]>Spring涔嬩簨浠剁洃鍚?/title><link>http://www.tkk7.com/gumingcn/archive/2010/09/01/330513.html</link><dc:creator>闃鍏?/dc:creator><author>闃鍏?/author><pubDate>Wed, 01 Sep 2010 02:41:00 GMT</pubDate><guid>http://www.tkk7.com/gumingcn/archive/2010/09/01/330513.html</guid><wfw:comment>http://www.tkk7.com/gumingcn/comments/330513.html</wfw:comment><comments>http://www.tkk7.com/gumingcn/archive/2010/09/01/330513.html#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://www.tkk7.com/gumingcn/comments/commentRss/330513.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/gumingcn/services/trackbacks/330513.html</trackback:ping><description><![CDATA[<div id="pxzjr7n" class="entry"> <p>鍐欏湪鍓嶉潰鐨勮瘽錛歴pring鐨勭洃鍚簨浠舵ā鍨嬪簲璇ユ槸瑙傚療鑰呮ā寮忋傛湰浜洪」鐩噷鐨勫簲鐢ㄥ湪process鏂規(guī)硶鎸夋棩鏈熷悓姝ユ煇涓簱鐨勬暟鎹紝鍦ㄦ柟娉曟渶鍚巔ublish涓涓猠vent浜嬩歡錛岃繖涓簨浠剁敤浜庡悗緇悓姝ヨ繃鏉ョ殑鏁版嵁澶勭悊銆備簨浠跺鐞嗛噰鐢ㄤ簡spring鐨勭洃鍚ā鍨?榪欐牱鍙互鍋氬埌process鏂規(guī)硶涓巈vent鍙互寮傛鍒嗙鎵ц銆傦紙娉細(xì)榪欎釜浜嬩歡妯″瀷緙虹渷浣跨敤<a name="181"><span style="color: red;">SyncTaskExecutor鏉ユ墽琛宭istener鐨勬敞鍐宔vent錛屾墍鏈夎listener娉ㄥ唽鐨別vent浜嬩歡涓?/span></a>鍚屾鎵ц鐨勶級銆?/p> <p>褰撶劧錛宻pring鐨勮繖涓満鍒惰繕鏈夊緢澶氬簲鐢ㄧ殑鍦烘櫙錛屽氨涓嶄竴涓鍒椾婦浜嗐?/p> <p><span style="color: #000000;"><strong>ApplicationEvent </strong></span></p> <p>浜嬩歡鎶借薄綾伙紝閲岄潰鍙湁涓涓瀯閫犲嚱鏁板拰涓涓猼imestamp銆?/p> <p><span style="color: #000000;"><strong>ApplicationListener</strong></span></p> <p>鐩戝惉鎺ュ彛錛岄噷闈㈠彧鏈変竴涓猳nApplicationEvent鏂規(guī)硶銆傞渶瑕佺敤鎴瘋嚜宸辯紪鍐橝pplicationListener鐨勫疄鐜般?/p> <p><strong>ApplicationContext</strong></p> <p>spring涓婁笅鏂?鍏秔ublishEvent鏂規(guī)硶鐢ㄤ簬閫氱煡鐩戝惉鍣?ApplicationListener鐨勫疄鐜?娉ㄥ唽event鏃墮棿.</p> <h3>publishEvent</h3> <pre>void <strong>publishEvent</strong>(<a title="class in org.springframework.context" >ApplicationEvent</a> event)</pre> <dl><dd> <p>Notify all listeners registered with this application of an application event.</p> </dd></dl> <p>婧愮爜瑙h錛?br /> 1.浣滀負(fù)ApplicationContext鐨勫疄鐜癆bstractApplicationContext.java鐨勬垚鍛樺彉閲?a name="181">applicationListeners錛屾槸涓涓狝rrayList,淇濆瓨浜嗘墍鏈夌殑</a><a name="181">ApplicationListener</a><br /> 2.鍒╃敤<strong>ApplicationEventMulticaster</strong>鎺ュ彛閲岀殑鏂規(guī)硶鏉ュ畬鎴愭敞鍐岀洃鍚?a class="r">addApplicationListener,縐婚櫎鐩戝惉</a><a class="r">removeApplicationListener錛?/a><a class="r">removeAllListeners錛屼互鍙婇氱煡鐩戝惉娉ㄥ唽浜嬩歡event錛?/a><a class="r">multicastEvent</a>(<a class="r">ApplicationEvent</a> <a class="r">event</a>);<br /> 涓婇潰璇村埌鐨刾ublishEvent鏂規(guī)硶鍗充嬌鐢ㄤ簡<a class="r">multicastEvent鏂規(guī)硶<br /> </a><br /> <strong>SimpleApplicationEventMultucaster</strong>浣滀負(fù)<a name="181">ApplicationEventMulticaster鐨勪竴涓疄鐜幫紝鎻愪緵浜唌ulticastEvent鐨勫疄鐜頒唬鐮侊紝鍏跺疄灝辨槸榪唬鎵鏈夌殑鐩戝惉鍣紝<span style="color: red;">鐢⊿yncTaskExecutor鍚屾鎵цlistener鐨刼nApplicationEvent</span></a></p> <p><a name="181"> public void multicastEvent(final ApplicationEvent event) {</a></p> <p><a name="181"> for (Iterator it = getApplicationListeners().iterator(); it</a></p> <p><a name="181"> .hasNext();) {</a></p> <p><a name="181"> final ApplicationListener listener = (ApplicationListener) it</a></p> <p><a name="181"> .next();</a></p> <p><a name="181"> getTaskExecutor().execute(new Runnable() {</a></p> <p><a name="181"> public void run() {</a></p> <p><a name="181"> listener.onApplicationEvent(event);<br /> }<br /> });<br /> }</a></p> <p>3.娉ㄦ剰浜嬮」錛氳嚜宸辯紪鍐橝pplicationListener鐨勫疄鐜版椂錛岃娉ㄦ剰涓嶅悓鐨勭洃鍚櫒澶勭悊涓嶅悓鐨勪簨浠訛紙澶嶅啓<a name="181">onApplicationEvent</a>錛夈傚師鍥犲氨鏄?a name="181">multicastEvent鐨勬墽琛屽師鐞嗐傚畠鏄凱浠f墽琛屾墍鏈夌殑鐩戝惉鍣?/a><a name="181">onApplicationEvent</a></p> <p><a name="181">榪欓噷鏄?/a><a name="181">ApplicationEventMulticaster鐨勭被鍒嗗竷鍥?/a><a style="width: 20px; height: 20px; text-indent: 20px; background-repeat: no-repeat; background-image: url("/CuteSoft_Client/CuteEditor/Load.ashx?type=image&file=anchor.gif");" name="181"></a></p> <p><a name="181"><strong><br /> </strong></a><br /> abstract public class AbstractApplicationEventMulticaster implements ApplicationEventMulticaster(Code)(Java Doc)<br /> public interface ApplicationEventMulticaster (Code)(Java Doc)</p> <p> public class SimpleApplicationEventMulticaster extends</p> <p>榪欓噷鏄疉pplicationContext鐨勭被鍒嗗竷鍥?br /> public class DefaultResourceLoader implements ResourceLoader(Code)(Java Doc)<br /> public interface ResourceLoader (Code)(Java Doc)</p> <p> abstract public class AbstractApplicationContext extends DefaultResourceLoader implements ConfigurableApplicationContext,DisposableBean(Code)(Java Doc)<br /> public interface ConfigurableApplicationContext extends ApplicationContext,Lifecycle(Code)(Java Doc)<br /> public interface DisposableBean (Code)(Java Doc)</p> <p> public class GenericApplicationContext extends AbstractApplicationContext implements BeanDefinitionRegistry(Code)(Java Doc)<br /> public interface BeanDefinitionRegistry (Code)(Java Doc)</p> <p> abstract public class AbstractRefreshableApplicationContext extends<br /> <a style="width: 20px; height: 20px; text-indent: 20px; background-repeat: no-repeat; background-image: url("/CuteSoft_Client/CuteEditor/Load.ashx?type=image&file=anchor.gif");" name="181"></a>涓嬮潰鏄痵pring鑷韓鐨勪簨浠跺簲鐢?br /> 1) ContextRefreshedEvent錛氬綋ApplicationContext鍒濆鍖栨垨鑰呭埛鏂版椂瑙﹀彂璇ヤ簨浠躲?br /> 2) ContextClosedEvent錛氬綋ApplicationContext琚叧闂椂瑙﹀彂璇ヤ簨浠躲傚鍣ㄨ鍏抽棴鏃訛紝鍏剁鐞嗙殑鎵鏈夊崟渚婤ean閮借閿姣併?br /> 3) RequestHandleEvent錛氬湪Web搴旂敤涓紝褰撲竴涓猦ttp璇鋒眰錛坮equest錛夌粨鏉熻Е鍙戣浜嬩歡銆?br /> 4) ContestStartedEvent錛氬綋瀹瑰櫒璋冪敤ConfigurableApplicationContext鐨凷tart()鏂規(guī)硶寮濮?閲嶆柊寮濮嬪鍣ㄦ椂瑙﹀彂璇ヤ簨浠躲?br /> 5) ContestStopedEvent錛氬綋瀹瑰櫒璋冪敤ConfigurableApplicationContext鐨凷top()鏂規(guī)硶鍋滄瀹瑰櫒鏃惰Е鍙戣浜嬩歡銆? </p> </div> <img src ="http://www.tkk7.com/gumingcn/aggbug/330513.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/gumingcn/" target="_blank">闃鍏?/a> 2010-09-01 10:41 <a href="http://www.tkk7.com/gumingcn/archive/2010/09/01/330513.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>ibatis鎬葷粨(1)http://www.tkk7.com/gumingcn/archive/2010/08/30/330342.html闃鍏?/dc:creator>闃鍏?/author>Mon, 30 Aug 2010 14:31:00 GMThttp://www.tkk7.com/gumingcn/archive/2010/08/30/330342.htmlhttp://www.tkk7.com/gumingcn/comments/330342.htmlhttp://www.tkk7.com/gumingcn/archive/2010/08/30/330342.html#Feedback0http://www.tkk7.com/gumingcn/comments/commentRss/330342.htmlhttp://www.tkk7.com/gumingcn/services/trackbacks/330342.html

1.瀹炰綋map.xml涓厤緗?
涓婚敭鑾峰彇鏂瑰紡閰嶇疆,mysql
<selectKey  resultClass="java.lang.Integer" keyProperty="id">
          select LAST_INSERT_ID()
</selectKey>

鍔ㄦ佹嫾鎺here鏉′歡
<dynamic prepend="where">
            <isNotNull>
                plateId=#value#
            </isNotNull>
</dynamic>
2.config閰嶇疆
typeAlias 瀹氫箟綾誨瀷鍒悕
<typeAlias alias="Item" type="com.tudou.tudoupromotion.entity.Item"/>

typeHandler 鑷畾涔夌被鍨嬭漿鎹?br /> 姣斿錛屽皢鏁版嵁搴撲腑鐨?錛?錛?鏍煎紡鐨勬暟鎹漿鎹負(fù)java 鏋氫婦
 <typeHandler javaType="com.tudou.tudoupromotion.entity.Plate" callback="com.tudou.tudoupromotion.ext.ibatis.PlateHandler"/>

綰跨▼緙撳瓨絳夐厤緗?/p>

    <settings
     cacheModelsEnabled="true"
     enhancementEnabled="true"
     lazyLoadingEnabled="false"
     maxRequests="32"
     maxSessions="10"
     maxTransactions="5"
     useStatementNamespaces="true"
    />
   cacheModelsEnabled="true"  鏄惁鍚姩緙撳瓨鏈哄埗
  enhancementEnabled="true"  鏄惁閽堝POJO鍚姩瀛楄妭鐮佸寮烘満鍒朵互鎻愬崌getter/setter鐨勮皟鐢ㄦ晥鑳介伩鍏嶄嬌鐢╦avaReflect鎵甯︽潵鐨勬ц兘寮閿銆傚悓鏃禠azy Loading甯︽潵鏋佸ぇ鐨勬ц兘鎻愬崌銆?br />   maxRequests鏈澶у茍鍙戣姹傛暟(Statement鏁?
  maxTransactions鏈澶у茍鍙戜簨鍔℃暟
  maxSessions鏈澶ession鏁幫紝鍗沖綋鍓嶆渶澶у厑璁哥殑騫跺彂SqlMapCliect鏁癿axSessions璁懼畾蹇呴』鐣屼簬 maxTransactions鍜宮axRequests涔嬮棿.鍗?nbsp;  maxTransactions>maxSessions>maxRequests



]]>
浣跨敤ORMUnit嫻嬭瘯鏁版嵁搴搒chema涓嶩ibernate 瀹炰綋鐨凪ap鍏崇郴http://www.tkk7.com/gumingcn/archive/2010/03/03/314407.html闃鍏?/dc:creator>闃鍏?/author>Wed, 03 Mar 2010 06:55:00 GMThttp://www.tkk7.com/gumingcn/archive/2010/03/03/314407.htmlhttp://www.tkk7.com/gumingcn/comments/314407.htmlhttp://www.tkk7.com/gumingcn/archive/2010/03/03/314407.html#Feedback0http://www.tkk7.com/gumingcn/comments/commentRss/314407.htmlhttp://www.tkk7.com/gumingcn/services/trackbacks/314407.html http://code.google.com/p/ormunit/
    鍦ㄥ仛闈㈠悜鍏崇郴鏁版嵁搴撶殑搴旂敤緋葷粺鐨勬椂鍊欙紝db琛ㄧ粨鏋勫湪寮鍙戣繃紼嬩腑錛屽彲鑳戒細(xì)鐢變簬鍓嶆湡鐨勮璁′笉瓚沖鑷翠笉鏂殑淇敼琛ㄧ粨鏋勩傚鏋淛ava灞傞潰閲囩敤綾諱技Hibernate ORM,闅忎箣瀵瑰簲鐨勬槸maps & pojos鐨勪慨鏀廣傛鏃朵慨鏀瑰悗鐨勭畝鍗曟祴璇曞氨鏄懼緱灝や負(fù)閲嶈銆?br />     ORMUnit鍔熻兘姣旇緝澶氾紝鏈枃鍙彇鍏跺皯鏁板嚑涓被錛屽畬鎴愪笂闈㈢殑鍔熻兘銆?br />     1.棣栧厛鏀瑰啓錛欻ibernateORMTestCase綾伙紝鎸囧畾鍔犺澆鐨刪ibernate.cfg.xml浣嶇疆
    public abstract class HibernateORMTestCase extends TestCase {
    protected Log logger = LogFactory.getLog(getClass());
    protected SessionFactory sessionFactory;
    //Location of hibernate.cfg.xml file.
    private static String CONFIG_FILE_LOCATION = "com/mmm/china/xxx/dbtest/hibernate.cfg.xml";
   
    protected Configuration cfg;
   
    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }
    /**
     * make configuration
     * @return
     */
    protected Configuration getConfiguration() {
        if (cfg == null) {
            cfg=new Configuration().configure(CONFIG_FILE_LOCATION);
        }
        return cfg;
    }

   } 
    2.HibernateSchemaChecker綾?媯鏌b schema map pojo)錛氭敼鍐欒緭鍑轟笉絎﹀悎map鍏崇郴鐨勮〃浠ュ強鍙樻洿鑴氭湰錛屽茍澧炲姞璁℃暟鍔熻兘
     List getSignificantDifferences(
            String[] script) {
        int num=0;
        List differences = new ArrayList();
        for (int i = 0; i < script.length; i++) {
            String line = script[i];
          
            if (line.indexOf("add constraint") == -1)
                {
                 differences.add(line);
                 logger.error("DIFF_LINE>>>>>>>>>>="+line);
                }
            else{
                num++;//璁$畻鏈夊灝戜釜澶栭敭鏈夐棶棰?br />                 logger.info("CONSTRAINT_LINE>>>>>>>>>>"+num+"="+line);
            }
        }
        return differences;
    }
      娉細(xì)ORMUnit 媯鏌ONSTRAINT 鏈夐棶棰橈紝鍦╠b涓簊qlserver鏃訛紝鐢熸垚鐨勫閿害鏉熺殑鍚嶇О鏄嚜鍔ㄥ懡鍚嶇殑錛屼笌瀹為檯鏁版嵁搴撶殑鍛藉悕涓嶄竴鑷達(dá)紝ORMUnit灝辮涓轟笉鍖歸厤錛屾墍浠ワ紝瑕佽繃婊dd constraint鐨別rror淇℃伅
   3.浣跨敤HibernateSchemaTests 榪涜junit嫻嬭瘯
    public class HibernateSchemaTests extends HibernateORMTestCase  {
   
    private HibernateSchemaChecker schemaChecker;

    protected void setUp() throws Exception {
        super.setUp();
        schemaChecker = new HibernateSchemaChecker(getConfiguration(), getConfiguration().buildSessionFactory());
    }

    /**
     * Verifies  all tables and columns referenced by the object/relational
     * mapping exist
     *
     * @throws Exception
     */
    public void assertDatabaseSchema() throws Exception {
        schemaChecker.assertDatabaseSchema();
    }

   }
  鎬葷粨錛氬彧闇瑕佷笁涓被錛屽嵆鍙祴璇曟暟鎹簱schema涓巋ibernate maps & pojo鐨刴ap鍏崇郴鏄惁瀹屽叏鍖歸厤錛屼簨鍗婂姛鍊嶃?br />

]]>
[瀵煎叆]Apache CouchDB鍦║buntu涓嬬殑瀹夎http://www.tkk7.com/gumingcn/archive/2010/02/27/314071.html闃鍏?/dc:creator>闃鍏?/author>Sat, 27 Feb 2010 07:38:00 GMThttp://www.tkk7.com/gumingcn/archive/2010/02/27/314071.htmlhttp://www.tkk7.com/gumingcn/comments/314071.htmlhttp://www.tkk7.com/gumingcn/archive/2010/02/27/314071.html#Feedback0http://www.tkk7.com/gumingcn/comments/commentRss/314071.htmlhttp://www.tkk7.com/gumingcn/services/trackbacks/314071.html  

鍏堜笅杞絚ouchdb瀹夎鏂囦歡錛氱増鏈負(fù)0.9.1

http://couchdb.apache.org/downloads.html

1寮濮嬪畨瑁呬緷璧栧寘

sudo apt-get build-dep couchdb

sudo apt-get install libmozjs-dev libicu-dev libcurl4-gnutls-dev libtool

2.瑙e帇緙?/p>

tar -zxvf apache-couchdb-0.9.1.tar.gz

3.寮濮嬪畨瑁?/p>

cd apache-couchdb-0.9.1

./configure

make

sudo make install

4.鍚姩couchdb

sudo couchdb

5.璁塊棶:http://127.0.0.1:5984/_utils/

鍚姩鎶ラ敊錛?/p>

$ bin/couchdb







Apache CouchDB 0.9.0a691361-incubating (LogLevel=info) is starting.



{"init terminating in do_boot",{{badmatch,{error,shutdown}},[{couch_server_sup,start_server,1},



{erl_eval,do_apply,5},{erl_eval,exprs,5},{init,start_it,1},{init,start_em,1}]}}



Crash dump was written to: erl_crash.dump



init terminating in do_boot ()



鏌ヤ簡涓涓嬪畼鏂箇iki:



鍘熸潵鏄畨瑁呮枃浠跺す鐨勬潈闄愰棶棰?br />






瑙e喅鍔炴硶錛?br />


sudo adduser couchdb



chown -R couchdb:couchdb /usr/local/etc/couchdb



chown -R couchdb:couchdb /usr/local/var/lib/couchdb



chown -R couchdb:couchdb /usr/local/var/log/couchdb



chown -R couchdb:couchdb /usr/local/var/run



chmod -R 0770 /usr/local/etc/couchdb



chmod -R 0770 /usr/local/var/lib/couchdb



chmod -R 0770 /usr/local/var/log/couchdb



chmod -R 0770 /usr/local/var/run







鍐嶆鍚姩錛岀湅鍒版榪庣晫闈紝鎵鏈夌殑testsuite run success,澶у姛鍛婃垚錛?/pre>

鏂囩珷鏉ユ簮:http://guming.blogbus.com/logs/45898514.html

]]> 主站蜘蛛池模板: 中文字幕免费视频一| 爽爽爽爽爽爽爽成人免费观看| 久久久久成人片免费观看蜜芽 | 中文字幕视频免费在线观看| 无码不卡亚洲成?人片| 高h视频在线免费观看| 免费h黄肉动漫在线观看| 特级毛片aaaa免费观看| 亚洲国产综合人成综合网站| 黄色网址免费在线观看| 亚洲午夜久久久久妓女影院 | 亚洲日产无码中文字幕| a级在线免费观看| 99久久亚洲精品无码毛片| 成人免费福利视频| 日韩亚洲国产综合高清| 小小影视日本动漫观看免费| 深夜福利在线免费观看| 亚洲人成人一区二区三区| 最近免费视频中文字幕大全| 亚洲av永久无码精品天堂久久| 在线观看免费污视频| 日本高清免费中文在线看| 亚洲国产精品无码av| 青草草色A免费观看在线| 亚洲精品动漫免费二区| 久久精品亚洲福利| 久久久久久免费一区二区三区| 亚洲第一网站免费视频| 尤物永久免费AV无码网站| 亚洲免费观看视频| 中文文字幕文字幕亚洲色| 亚洲AⅤ视频一区二区三区| 中文字幕无码免费久久| 亚洲AV一二三区成人影片| 亚洲AV无码乱码精品国产| 久久久久久久久久国产精品免费 | 色婷婷综合缴情综免费观看| 亚洲人成网址在线观看| 在线观看永久免费视频网站| 男女作爱在线播放免费网站|