谢谢大家,特别是floater斑竹!
小弟还有一些问题麻烦。。。。。
1. Persist layer should be coded against interfaces so that you can switch between different implementations, like jdbc, entity beans, hibernate, jdo, etc.
这条太好了。持久层做成接口,用实体bean、jdbc、jdo实现都可以。客户端只要知道这个接口就行。确实很好。小弟经验少,有点肤浅的问题,实体bean、hibernate产生的类等怎么和自己系统定义的接口很好的关联?我的意思是这样的:
假设系统定义一个接口:
public interface User extends java.io.Serializable
{
public long getID();
............
}
对接口User用EJB实体bean来实现,
public interface UserEJB extends EJBObject
{
............
}
public class UserEJBBean implements EntityBean
{
.........
}
public interface UserEJBHome extends EJBHome
{
.........
}
UserEJB怎么和User接口很好地关联?
3. Web or GUI interface should be isolated too. Application/business logic should be coded in javabean or standard class, session beans should serve as glues at best, or simply out of the picture if entity bean is not used.
sessin bean最好作为粘合剂?(业务逻辑和数据层之间的?)或者说如果实体bean不用的话,session bean也彻底不要了(out of the picture是这个意思么,见笑)。如果session bean不要,GUI的程序有什么方式得到远程对象?