读书人

Hibernate Core Reference Manual学习

发布时间: 2013-01-21 10:15:39 作者: rapoo

Hibernate Core Reference Manual学习笔记——Chapter 4. Persistent Classes

?
Example 4.3. Disabling proxies in annotations

?
Example 4.5. Proxying an interface in annotations

public class Cat {    ...    public boolean equals(Object other) {        if (this == other) return true;        if ( !(other instanceof Cat) ) return false;        final Cat cat = (Cat) other;        if ( !cat.getLitterId().equals( getLitterId() ) ) return false;        if ( !cat.getMother().equals( getMother() ) ) return false;        return true;    }    public int hashCode() {        int result;        result = getMother().hashCode();        result = 29 * result + getLitterId();        return result;    }}

?
business key不一定非要是数据库的主键。不可变或者唯一键都可以作为business key。

4.4. Dynamic models
Note
The following features are currently considered experimental and may change in the near future.
4.5. Tuplizers
4.6. EntityNameResolvers(以后看)

?

读书人网 >软件架构设计

热点推荐