关于确定jivejdon3的一点问题

为什么你的DAO,也可以创建领域模型呢。
比如
public interface AccountDao {
/**
* this for login
* @param username
* @param password
* @return Account or null
*/
Account getAccount(String username, String password);

/**
* this for service, not open
* @param userId
* @return account
*/
Account getAccount(String userId);
Account getAccountByName(String username);
Account getAccountByEmail(String email);
void createAccount(Account account) throws Exception;
void updateAccount(Account account) throws Exception;
void deleteAccount(Account account) throws Exception;
PageIterator getAccounts(int start, int count);
}
在这里,Account不是领域模型吗,不是应该由Repository来创建嘛?
如果用Hibernate,一般DAO就返回POJO,在由Repository来返回domin model嘛?
看了JIVEJDON的代码,我又觉的hibernate有点多余。那我们用hibernate来完成什么职责呢?
我们现在用的时候,只是讲数据局库字段,映射为一个对应的POJO,请BANG给我解释一下,谢谢

愚见:从hibernate这些持久层包括DAO取出来的数据都是死数据,对象冬眠,冬眠了一个对象需要持久的那一部分,而要把这个冬眠对象唤醒我们需要repository或者工厂,一旦唤醒一个对象它就有可能经历各种生命状态,这些生命对象需要repository来管理或者构造,这个活生生的对象只存在于仓储中,应用只需要和仓储打交到即可,仓储面向上层应用,屏蔽掉底层持久技术比如hibernate或者jdbc模板!

为什么,Dao要返回 domin对象呢