【问题标题】:EntityManager inside Entity Bean how-toEntity Bean 中的 EntityManager 操作方法
【发布时间】:2012-05-10 10:37:11
【问题描述】:

如何使用(注入)entityManager 到实体 Bean? 在我的 Entity bean 中,我有一些验证需要对其他(不相关的)实体进行查询,即某种 List-Of-Values 实体。这样做的正确方法是什么?将 EntityManager 放入 Entity Bean 的构造函数中?还是什么?

【问题讨论】:

标签: entity ejb-3.0 entitymanager


【解决方案1】:

实体 bean(通常)不支持任何类型的注入,因为它们不是由容器创建的。

这个一般主题最近在 JSR-338 (JPA 2.1) 邮件列表中出现了 discussedreasons were given 为什么通常认为实体引用实体管理器是个坏主意。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-11-19
    • 2016-12-23
    • 2013-01-19
    • 1970-01-01
    • 1970-01-01
    • 2012-07-25
    • 2017-09-21
    • 2017-02-12
    相关资源
    最近更新 更多