JiveJdon Community Forums
在线182人 Home | 论坛 | 培训咨询 | 精华 | 查搜 | 注册 | 登陆 |
首页 » 论坛 » 设计模式、框架和架构
???en_US.forumThreadPrev.name??? 上一主题
Go back to the topic listing   返回主题列表
???en_US.forumThreadNext.name??? 下一主题
这个主题共有 2 回复 / 1 页 [ ]  发表新帖子  回复该主题贴
jjyy4

发表文章: 2
注册时间: 2008年05月07日 14:52
给他发消息
关于确定jivejdon3的一点问题 发表: 2008年05月07日 15:18 回复
为什么你的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给我解释一下,谢谢
oojdon

发表文章: 149
注册时间: 2007年10月29日 13:55
给他发消息
回复:关于确定jivejdon3的一点问题 发表: 2008年05月07日 15:30 回复
愚见:从Hibernate这些持久层包括DAO取出来的数据都是死数据,对象冬眠,冬眠了一个对象需要持久的那一部分,而要把这个冬眠对象唤醒我们需要repository或者工厂,一旦唤醒一个对象它就有可能经历各种生命状态,这些生命对象需要repository来管理或者构造,这个活生生的对象只存在于仓储中,应用只需要和仓储打交到即可,仓储面向上层应用,屏蔽掉底层持久技术比如Hibernate或者jdbc模板!

jjyy4

发表文章: 2
注册时间: 2008年05月07日 14:52
给他发消息
re:关于确定jivejdon3的一点问题 发表: 2008年05月07日 15:40 回复
为什么,Dao要返回 domin对象呢
这个主题有 2 回复 / 1 页 [ ]
???en_US.forumThreadPrev.name??? 上一主题
Go back to the topic listing   返回主题列表    返回页首  返回页首
???en_US.forumThreadNext.name??? 下一主题
热点TAG: AOP cache DDD EJB 集群 设计模式 Hibernate IOC JiveJdon OO RBAC Spring Struts
查询本论坛内 回复超过的热门帖子
快速发表回复
标题
 
粗体 斜体 下划线 插入图片 插入代码 插入url链接 插入附件
内容
 

解惑之道在J道 ,打造中国最具影响力的的企业软件社区
OpenSource JIVEJDON v3.0 Powered by JdonFramework Code © 2002-08 jdon.com

anti spam