一般来说
使用JSP-SessionBean-CMP模式时
CMP一定是LocalEntityBean
这样可以提高一定的性能,因为性能的瓶颈在于数据库的存取,如果使用RemoteEntityBean的话,其中还会有一个根程序与骨架程序之间网络传输问题
而且这种模式中,一般还要使用值对象的设计模式
光是值对象,已经能提高不少性能了
这两个加起来应该会提高不少效率呢给你一个例子,使我的一个朋友做的实验:
------------------------------------------------------------
页面共需要读入16个值(两次循环,每次8个)。方案1:JSP直接调用EntityBean的remote的getXXX方法16次。
结果:顺序访问页面2000次,用时124秒。方案2:JSP调用EntityBean内自定义的remote方法:getValueObject
并用ValueObject返回包含的信息。其它均与方案1相同。
结果:顺序访问页面2000次,用时47秒。速度提高了将近3倍,确实可观!
------------------------------------------------------------

解决方案 »

  1.   

    能把你的例子发给我看看吗?[email protected],谢谢
      

  2.   

    这是一种典型的设计模式,最大的好处就是通过SESSION-ENTITY之间的本地访问实现性能的流畅。
    One common design pattern is to route all entity bean access through session beans. EJB clients call methods on the session bean, which forwards the methods to one or more entity bean methods, as appropriate. This is called a session-entity facade. 
    The session-entity facade design pattern has many advantages, including the ability to streamline performance by using local access for session-entity bean communication
      

  3.   

    Session Bean 主要负责抽象表达业务逻辑,尽量避免在上使用关系来表达业务模型。Entity Bean 来实现数据库访问,执行单纯的数据读取和修改工作。两者分离,便于维护。