锘??xml version="1.0" encoding="utf-8" standalone="yes"?>精品福利av,毛片在线免费,国产欧美一区二区三区精品观看http://www.aygfsteel.com/honzeland/category/43478.html璁板綍鐐規淮銆傘傘?/description>zh-cnSat, 09 Oct 2010 05:20:35 GMTSat, 09 Oct 2010 05:20:35 GMT60GWT 2 Spring 3 JPA 2 Hibernate 3.5 Tutorial 鈥?Eclipse and Maven 2 showcase http://www.aygfsteel.com/honzeland/archive/2010/08/20/329452.htmlhonzelandhonzelandFri, 20 Aug 2010 05:01:00 GMThttp://www.aygfsteel.com/honzeland/archive/2010/08/20/329452.htmlhttp://www.aygfsteel.com/honzeland/comments/329452.htmlhttp://www.aygfsteel.com/honzeland/archive/2010/08/20/329452.html#Feedback0http://www.aygfsteel.com/honzeland/comments/commentRss/329452.htmlhttp://www.aygfsteel.com/honzeland/services/trackbacks/329452.htmlhttp://www.javacodegeeks.com/2010/07/gwt-2-spring-3-jpa-2-hibernate-35.html

honzeland 2010-08-20 13:01 鍙戣〃璇勮
]]>
Hibernate Annotationshttp://www.aygfsteel.com/honzeland/archive/2010/04/20/318875.htmlhonzelandhonzelandTue, 20 Apr 2010 09:20:00 GMThttp://www.aygfsteel.com/honzeland/archive/2010/04/20/318875.htmlhttp://www.aygfsteel.com/honzeland/comments/318875.htmlhttp://www.aygfsteel.com/honzeland/archive/2010/04/20/318875.html#Feedback0http://www.aygfsteel.com/honzeland/comments/commentRss/318875.htmlhttp://www.aygfsteel.com/honzeland/services/trackbacks/318875.htmlUse one single table "blank_fields" for both A and B. "blank_fields" has fields: 'ref_id', 'blank_field', 'type'. 'type' is used to identify which entity the record belongs to. Use 'type' + 'ref_id' to specify the collection of elements for one entity.

@Entity
@Table(name 
= "table_a")
public class A {
    
private Set<BlankField> blankFields = new HashSet<BlankField>();
   
    @CollectionOfElements
    @Fetch(FetchMode.SUBSELECT)
    @Enumerated(EnumType.ORDINAL)
    @JoinTable(name 
= "blank_fields", joinColumns = { @JoinColumn(name = "ref_id") })
    @Cascade(value 
= org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
    @Column(name 
= "blank_field", nullable = false)
    @SQLInsert(sql 
= "INSERT INTO blank_fields(ref_id, blank_field, type) VALUES(?,?,0)")
    @Where(clause 
= "type=0")
    
public Set<BlankField> getBlankFields() { // BlankField is an enum
        
return blankFields;
    }

    @SuppressWarnings(
"unused")
    
private void setBlankFields(Set<BlankField> blankFields) {
        
this.blankFields = blankFields;
    }
// End B

@Entity
@Table(name 
= "table_b")
public class B {
    
private Set<BlankField> blankFields = new HashSet<BlankField>();
   
    @CollectionOfElements
    @Fetch(FetchMode.SUBSELECT)
    @Enumerated(EnumType.ORDINAL)
    @JoinTable(name 
= "blank_fields", joinColumns = { @JoinColumn(name = "ref_id") })
    @Cascade(value 
= org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
    @Column(name 
= "blank_field", nullable = false)
    @SQLInsert(sql 
= "INSERT INTO blank_fields(ref_id, blank_field, type) VALUES(?,?,1)"// used for insert
    @Where(clause = "type=1"// used for query, if not @CollectionOfElements, such as @OneToMany, use @WhereJoinTable instead
    public Set<BlankField> getBlankFields() {
        
return blankFields;
    }

    @SuppressWarnings(
"unused")
    
private void setBlankFields(Set<BlankField> blankFields) {
        
this.blankFields = blankFields;
    }
}

褰撶劧榪樻湁鍏朵粬鐨勬柟寮忔潵瀹炵幇涓婇潰鐨勯渶姹傦紝涓婇潰閲囩敤鐨勫崟琛ㄦ潵璁板綍涓嶅悓瀹炰綋鐨刟ssociations錛堣繖鍎挎槸CollectionOfElements錛屽茍涓旇繑鍥炵殑鏄疭et<Enum>錛屼笉鏄疭et<Embeddable>)錛岀劧鍚庣敤'type'鏉ュ尯鍒嗕笉鍚岀殑瀹炰綋錛岃繖鏍峰仛鐨勫ソ澶勬槸錛氭暟鎹簱鍐椾綑灝戯紝鏄撲簬鎵╁睍錛屽浜庢柊鐨勫疄浣擄紝鍙渶鍔犱竴涓猼ype鍊鹼紝鑰屼笉闇鏇存敼鏁版嵁搴撹〃緇撴瀯銆傚彟澶栦竴縐嶉噰鐢ㄥ崟琛ㄧ殑鏂瑰紡鏄負姣忎釜瀹炰綋澧炲姞鏂扮殑瀛楁錛屽
"blank_fields": 'a_id', 'b_id', 'blank_field', a_id reference table_a (id), b_id reference table_b (id). 榪欐牱鍦ㄦ槧灝勭殑鏃跺欐洿綆鍗曪紝
瀵逛簬A錛屾槧灝勪負
@JoinTable(name = "blank_fields", joinColumns = { @JoinColumn(name = "a_id") })
瀵逛簬B錛屾槧灝勪負
@JoinTable(name = "blank_fields", joinColumns = { @JoinColumn(name = "b_id") })
榪欐牱浣滅殑緙虹偣鏄細甯︽潵浜嗘暟鎹簱鍐椾綑錛屽浜?span style="color: #000000;">blank_fields鏉ヨ錛屼換涓鏉¤褰曪紝a_id鍜宐_id涓彧鏈変竴涓笉涓簄ull銆傚綋澶氫釜瀹炰綋鍏辯敤榪欎釜琛ㄦ椂錛岀敤涓婇潰鐨勬柟娉曟洿鍚堢悊錛屽鏋滃叡鐢ㄥ疄浣撲笉澶氭椂錛岃繖縐嶆柟娉曟洿鏂逛究銆?/span>

honzeland 2010-04-20 17:20 鍙戣〃璇勮
]]>
One Hibernate Session Multiple Transactionshttp://www.aygfsteel.com/honzeland/archive/2010/03/01/314150.htmlhonzelandhonzelandMon, 01 Mar 2010 03:47:00 GMThttp://www.aygfsteel.com/honzeland/archive/2010/03/01/314150.htmlhttp://www.aygfsteel.com/honzeland/comments/314150.htmlhttp://www.aygfsteel.com/honzeland/archive/2010/03/01/314150.html#Feedback0http://www.aygfsteel.com/honzeland/comments/commentRss/314150.htmlhttp://www.aygfsteel.com/honzeland/services/trackbacks/314150.html each transaction would NOT affect others.
i.e., open multiple transactions on the same session, even though one transaction rolls back, other transactions can be committed. If one action fails, others should fail too, then we should use one transaction for all actions.

Note:
A rollback with a single Session will lead to that Session being cleared (through "Session.clear()").
So do lazy collections still work if the session is cleared? =>Not of any objects that you loaded up until the rollback. Only for new objects loaded afterwards.
We should load necessary objects to session for each transactional action to avoid LazyInitializationException, even if those objects are loaded before other forward transactional actions, since forward action may be rolled back and clear the session.

BTW, Hibernate Session.merge() is different with Session.update() by:
Item item2 = session.merge(item);
item2 
== item; // false, item - DETACHED, item2 - PERSIST
session.update(item); // no return value, make item PERSIST




honzeland 2010-03-01 11:47 鍙戣〃璇勮
]]>
org.springframework.transaction.UnexpectedRollbackException: Transaction rolled back because it has been marked as rollback-onlyhttp://www.aygfsteel.com/honzeland/archive/2010/02/24/313829.htmlhonzelandhonzelandWed, 24 Feb 2010 10:02:00 GMThttp://www.aygfsteel.com/honzeland/archive/2010/02/24/313829.htmlhttp://www.aygfsteel.com/honzeland/comments/313829.htmlhttp://www.aygfsteel.com/honzeland/archive/2010/02/24/313829.html#Feedback0http://www.aygfsteel.com/honzeland/comments/commentRss/313829.htmlhttp://www.aygfsteel.com/honzeland/services/trackbacks/313829.html
    @Transactional
    
public void foo() {
        
try{
            bar();
        } 
catch (RuntimeException re) {
            
// caught but not throw further
            
        }
        
    }

    @Transactional
    
public void bar() {
        
    }
濡傛灉foo鍦ㄨ皟鐢╞ar鐨勬椂鍊欙紝bar鎶涘嚭RuntimeException錛孲pring鍦╞ar return鏃跺皢Transactional鏍囪涓篟ollback only錛?鑰宖oo鎹曡幏浜哹ar鐨凴untimeException錛屾墍浠pring灝嗕細commit foo鐨勪簨鍔★紝浣嗘槸foo鍜宐ar浣跨敤鐨勬槸鍚屼竴浜嬪姟錛屽洜姝ゅ湪commit foo浜嬪姟鏃訛紝灝嗕細鎶涘嚭UnexpectedRollbackException銆傛敞鎰忥細濡傛灉foo鍜宐ar鍦ㄥ悓涓class涓紝涓嶄細鍑虹幇榪欑鎯呭喌錛屽洜涓猴細

Since this mechanism is based on proxies, only 'external' method calls coming in through the proxy will be intercepted. This means that 'self-invocation', i.e. a method within the target object calling some other method of the target object, won't lead to an actual transaction at runtime even if the invoked method is marked with @Transactional!

鍙互閫氳繃閰嶇疆log4j鏉ebug Spring浜嬪姟鑾峰彇鎯呭喌錛?br /> To delve more into it I would turn up your log4j logging to debug and also look at what ExerciseModuleController is doing at line 91, e.g.: add a logger for org.springframework.transaction


honzeland 2010-02-24 18:02 鍙戣〃璇勮
]]>
Discussion for Open Session In View Pattern for Hibernatehttp://www.aygfsteel.com/honzeland/archive/2010/01/29/311244.htmlhonzelandhonzelandFri, 29 Jan 2010 09:20:00 GMThttp://www.aygfsteel.com/honzeland/archive/2010/01/29/311244.htmlhttp://www.aygfsteel.com/honzeland/comments/311244.htmlhttp://www.aygfsteel.com/honzeland/archive/2010/01/29/311244.html#Feedback0http://www.aygfsteel.com/honzeland/comments/commentRss/311244.htmlhttp://www.aygfsteel.com/honzeland/services/trackbacks/311244.htmlhttp://www.mail-archive.com/stripes-users@lists.sourceforge.net/msg02908.html




honzeland 2010-01-29 17:20 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 蓬溪县| 崇明县| 双流县| 思南县| 天等县| 东光县| 苗栗县| 黎城县| 安徽省| 开平市| 泽库县| 万全县| 门头沟区| 汤原县| 梅州市| 达州市| 当雄县| 罗山县| 固阳县| 安新县| 日土县| 蓝山县| 寿阳县| 盈江县| 泰安市| 鸡泽县| 肇庆市| 广西| 同江市| 荆州市| 安康市| 方正县| 凤冈县| 称多县| 黄大仙区| 辽中县| 铜陵市| 资溪县| 仙游县| 榆社县| 资讯 |