ejb-jar.xml:容器事务标记的允许方法

时间:2009-09-27 21:23:27

标签: java java-ee weblogic ejb transactions

我们是否可以在<container-transaction><method></method></contaner-transaction>代码中指定一个带有“受保护”或“私有”访问修饰符的方法名称?

以下是ejb-jar.xml的示例:

<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1">
      <enterprise-beans>
        <session>
          <ejb-name>myEJBName</ejb-name>
          <home>myEJBHome</home>
          <remote>myEJBInterface</remote>
          <ejb-class>myEJBClass</ejb-class>
          <session-type>Stateless</session-type>
          <transaction-type>Container</transaction-type>
        </session>
      </enterprise-beans>
      <assembly-descriptor>
        <security-role>
          <role-name>mySecurityRole</role-name>
        </security-role>
        <method-permission>
          <description></description>
          <role-name>myRoleName</role-name>
          <method>myEJBMethod</ejb-name>
            <method-intf>Remote</method-intf>
            <method-name>*</method-name>
          </method>
        </method-permission>
        <container-transaction>
          <method>
            <ejb-name>myEJB</ejb-name>
            <method-intf>Remote</method-intf>
            <method-name>myEJBMethod</method-name>
          </method>
          <trans-attribute>Required</trans-attribute>
        </container-transaction>
      </assembly-descriptor>
</ejb-jar>

1 个答案:

答案 0 :(得分:2)

不,EJB方法总是公开的。