Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java EE 综合讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Re:寻最佳系统构架? [Re:yadan]
floater

Java Jedi

总版主


发贴: 3233
积分: 421
于 2003-06-18 22:22 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
For #1, this is the general rule. However for entity beans, this is exceptional(that's why I say that if no entity bean). The reason behind it is the cost of network traffic. You have to reduce the network overhead for entity beans by using local interfaces of entity beans.

For other options, jdbc, hibernate, etc. It's pretty straight forward

public interface User
{
public long getID();
}

public class JDBCUser implements User
{
public long getID()
{
//get DataSource, get connection, get user
}
}

public class JDOUser() implements User
{
public long getID()
{
//do it in JDO way
}
}

....

Then in your client code using User would like this:
User user = (User) DB.createUser();
long i = user.getID();

In your DB class:
public User createUser()
{
//get class name from configure file and initiate the class, it must be one of JDBCUser, JDOUser, etc.
//return the object.
}

You may need to pass in some parameters to create the user object.

For #3, there are many options with certain restrains on the network side. I don't know the way that your GUI connects to the server, it could be http, rmi, or sockets, etc. So my point is whenever possible, don't use session bean for business logic(out of the picture=get it out of my way, Tongue). Otherwise you would have a dependency from business logic to ejb container, this doesn't make sense in general.



"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."
- Martin Fowler, Refactoring - Improving the Design of Existing Code

话题树型展开
人气 标题 作者 字数 发贴时间
8423 寻最佳系统构架? yadan 549 2003-06-18 10:03
8076 Re:寻最佳系统构架? jameszhang 61 2003-06-18 11:28
7495 Re:寻最佳系统构架? bujinwang 680 2003-06-18 11:43
7430 Re:寻最佳系统构架? floater 791 2003-06-18 12:26
7459 Re:寻最佳系统构架? yadan 1110 2003-06-18 14:46
7402 Re:寻最佳系统构架? floater 1443 2003-06-18 22:22
7425 Re:寻最佳系统构架? yadan 1104 2003-06-19 10:23
7362 Re:寻最佳系统构架? floater 188 2003-06-19 12:51
7651 Re:寻最佳系统构架? juweiping 183 2003-06-19 13:34
7448 Re:寻最佳系统构架? yadan 280 2003-06-19 15:08
7625 Re:寻最佳系统构架? juweiping 151 2003-06-19 15:49
7446 Re:寻最佳系统构架? yadan 238 2003-06-19 16:07
7545 Re:寻最佳系统构架? Julian13 1236 2003-06-19 09:09
7373 Re:寻最佳系统构架? floater 1313 2003-06-19 12:49
7771 Re:寻最佳系统构架? juweiping 163 2003-06-19 16:26

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923