honzeland

记录点滴。。。

常用链接

统计

Famous Websites

Java

Linux

P2P

最新评论

2010年4月20日 #

Interesting books read or being read

Oracle Performance Tuning for 10gR2, Second Edition -- http://www.amazon.com/Oracle-Performance-Tuning-10gR2-Second/dp/1555583458

posted @ 2011-04-07 15:30 honzeland 阅读(194) | 评论 (0)编辑 收藏

GAE Logging

Official document: http://code.google.com/appengine/docs/java/runtime.html#Logging  
Log4j configuration in production env:
http://blog.xam.de/2010/03/logging-in-google-appengine-for-java.html 
http://www.mail-archive.com/google-appengine-java@googlegroups.com/msg06396.html

posted @ 2010-11-11 12:52 honzeland 阅读(260) | 评论 (0)编辑 收藏

Read a Stress Test Report

Load Average: 

1. http://www.teamquest.com/resources/gunther/display/5/index.htm
2. 
http://blog.scoutapp.com/articles/2009/07/31/understanding-load-averages (Great)

posted @ 2010-11-05 14:16 honzeland 阅读(265) | 评论 (0)编辑 收藏

GAE Mapping

Executing Simple Joins Across Owned Relationships

posted @ 2010-10-27 13:27 honzeland 阅读(243) | 评论 (0)编辑 收藏

Servlet Mappings - rules, pattern....

http://www.rawbw.com/~davidm/tini/TiniHttpServer/docs/ServletMappings.html

posted @ 2010-10-22 22:41 honzeland 阅读(276) | 评论 (0)编辑 收藏

GWT-RPC in a Nutshell - go through the internal

GWT-RPC in a Nutshell: http://www.gdssecurity.com/l/b/2009/10/08/gwt-rpc-in-a-nutshell/

posted @ 2010-10-22 22:40 honzeland 阅读(215) | 评论 (0)编辑 收藏

[zz] Tuning Your Stress Test Harness

HTTP://WWW.THESERVERSIDE.COM/NEWS/1365219/TUNING-YOUR-STRESS-TEST-HARNESS?ASRC=SS_CLA_315053&PSRC=CLT_81

posted @ 2010-09-11 12:27 honzeland 阅读(238) | 评论 (0)编辑 收藏

GWT 2 Spring 3 JPA 2 Hibernate 3.5 Tutorial – Eclipse and Maven 2 showcase

See details at: http://www.javacodegeeks.com/2010/07/gwt-2-spring-3-jpa-2-hibernate-35.html
Executing Simple Joins Across Owned Relationships for gae: http://gae-java-persistence.blogspot.com/2010/03/executing-simple-joins-across-owned.html

posted @ 2010-08-20 13:01 honzeland 阅读(410) | 评论 (0)编辑 收藏

Java remote invocation frameworks (RPC)

1. Remote Method Invocation (RMI)

2. Hessian

3. Burlap

4. HTTP invoker

5. EJB

6. JAX-RPC

7. JMX

posted @ 2010-06-09 14:25 honzeland 阅读(240) | 评论 (0)编辑 收藏

Tomcat Architecture Diagram

zz from http://marakana.com/forums/tomcat/general/106.html


Valve and Filter:
"Valve" is Tomcat specific notion, and they get applied at a higher level than anything in a specific webapp. Also, they work only in Tomcat.

"Filter" is a Servlet Specification notion and should work in any compliant servlet container. They get applied at a lower level than all of Tomcat's
Valves.

However, consider also the division between your application and the application  server. Think whether the feature you're planning is part of your application, or is it rather a generic feature of the application server, which could have uses in other applications as well. This would be the correct criteria to decide between Valve and Filter.

Order for filter: The order in which they are defined matters. The container will execute the filters in the order in which they are defined.

posted @ 2010-05-10 10:39 honzeland 阅读(1477) | 评论 (0)编辑 收藏

Hibernate Annotations

Use 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;
    }
}

当然还有其他的方式来实现上面的需求,上面采用的单表来记录不同实体的associations(这儿是CollectionOfElements,并且返回的是Set<Enum>,不是Set<Embeddable>),然后用'type'来区分不同的实体,这样做的好处是:数据库冗余少,易于扩展,对于新的实体,只需加一个type值,而不需更改数据库表结构。另外一种采用单表的方式是为每个实体增加新的字段,如
"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") })
这样作的缺点是:带来了数据库冗余,对于blank_fields来讲,任一条记录,a_id和b_id中只有一个不为null。当多个实体共用这个表时,用上面的方法更合理,如果共用实体不多时,这种方法更方便。

posted @ 2010-04-20 17:20 honzeland 阅读(453) | 评论 (0)编辑 收藏