EJB 3.0 xml descriptor Examples

File ejb-jar.xml:

Simple local:

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns = "http://java.sun.com/xml/ns/javaee" 
         version = "3.1"
         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">
    
    <enterprise-beans>
        <session>
            <ejb-name>AclService</ejb-name>
            <ejb-class>gob.documental.service.AclServiceDatabase</ejb-class>
            <business-local>gob.documental.service.AclService</business-local>
            <session-type>Stateless</session-type>
            <transaction-type>Container</transaction-type>
        </session>
    </enterprise-beans>
    
</ejb-jar>

Local and Remote:

<ejb-jar 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_0.xsd"
         version="3.0">
  <enterprise-beans>
    <session>
      <ejb-name>CalculatorImpl</ejb-name>
      <business-local>org.superbiz.calculator.CalculatorLocal</business-local>
      <business-remote>org.superbiz.calculator.CalculatorRemote</business-remote>
      <ejb-class>org.superbiz.calculator.CalculatorImpl</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
    </session>
  </enterprise-beans>
</ejb-jar>

Interceptors:

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
  <enterprise-beans>
    <session>
      <ejb-name>TestBean</ejb-name>
      <ejb-ref>
        <ejb-ref-name>ejb/fooremote</ejb-ref-name>
        <ejb-ref-type>Session</ejb-ref-type>
        <remote>test.FooRemoteIF</remote>
      </ejb-ref>
      <env-entry>
        <description>admin email</description>
        <env-entry-name>adminEmail</env-entry-name>
        <env-entry-value>admin@example.x</env-entry-value>
      </env-entry>
    </session>
  </enterprise-beans>

  <interceptors>
    <interceptor>
      <interceptor-class>test.Interceptor1</interceptor-class>
    </interceptor>
  </interceptors>

  <assembly-descriptor>
    <interceptor-binding>
      <ejb-name>*</ejb-name>
      <interceptor-class>test.Interceptor1</interceptor-class>
    </interceptor-binding>
  </assembly-descriptor>
</ejb-jar>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s