Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用 EJB 在视图模式中打开会话???
我找到了 Servlet,但不是 EJB
非常感谢!
OpenSessionInView 是一种(n)(反)模式,适用于基于 Web 的 MVC 应用程序,以便在“V”视图中保持会话打开,以实现持久性框架的延迟加载机制。如果您不实现 Web 应用程序,则实际上不需要实现此模式。应用程序服务器为您执行 EJB 之类的会话管理。您只需要配置您的持久性上下文并在您的 JavaBeans 中注入 EntityManager。