我们可以在EJB 3.0中使用ejb-jar.xml而不是MessageDrivenBean(MDB)的注释吗? [英] Can we use ejb-jar.xml instead of annotations for MessageDrivenBean(MDB) in EJB 3.0?

查看:147
本文介绍了我们可以在EJB 3.0中使用ejb-jar.xml而不是MessageDrivenBean(MDB)的注释吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用EJB 3.0中的 @ActivationConfigProperty 配置了消息目标类型,名称等等,但是我想配置 MDB 使用EJB 2.0中的部署描述符( ejb-jar.xml )。

I've configured the message destination type, name etc using @ActivationConfigProperty in EJB 3.0 but I wanted to configure the MDB using deployment descriptor (ejb-jar.xml) as in EJB 2.0.

FYI: m使用JBoss 6

FYI: I'm using JBoss 6

有人可以指导我吗?

推荐答案

Thanks man, but I've figured it out in a much simpler way. Below is the code

<ejb-jar id="ejb-jar_ID" version="3.1"
      xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                          http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd">

  <display-name>SampleTransactionMDB</display-name>
  <enterprise-beans>
    <message-driven>
      <display-name>SampleTransactionMDB</display-name>
      <ejb-name>SampleTransactionMDB</ejb-name>
      <ejb-class>com.example.SampleTransactionMDB</ejb-class>
      <transaction-type>Container</transaction-type>
      <activation-config>
        <activation-config-property>
          <activation-config-property-name>destinationType</activation-config-property-name>
          <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>destination</activation-config-property-name>
          <activation-config-property-value>/queue/SampleTransactionQueue</activation-config-property-value>
        </activation-config-property> 
      </activation-config>
    </message-driven>  
  </enterprise-beans>
  <assembly-descriptor>
  </assembly-descriptor>
</ejb-jar>

这篇关于我们可以在EJB 3.0中使用ejb-jar.xml而不是MessageDrivenBean(MDB)的注释吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆