users@glassfish.java.net

Re: Annotation/DD questions....

From: Cheng Fang <Cheng.Fang_at_Sun.COM>
Date: Fri, 23 Jun 2006 08:14:31 -0400

In your annotation-free examples, all metadata is in descriptor
ejb-jar.xml. Note: it's <business-remote> or <business-local> for
remote or local business interface. They are usually not <local> or
<remote> component interface as in ejb 2.x, though you can have all of
<home> <remote> <local-home> <local> <business-remote> <business-local>
in one session bean.
        <session>
            <display-name>display name</display-name>
            <ejb-name>my-bean</ejb-name>
            <business-remote>com.something.MyInterface</business-remote>
            <ejb-class>com.something.MyBean</ejb-class>
            <session-type>Stateless</session-type>
            <transaction-type>Container</transaction-type>
        </session>
    </enterprise-beans>

If your classes already have annotations but you want to ignore them and
use xml descriptor instead, you can use the metadata-complete="true"
attribute in ejb-jar.xml. For example,
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
metadata-complete="true" version="3.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">

This is from ejb-jar_3_0.xsd:
    <xsd:attribute name="metadata-complete" type="xsd:boolean">
      <xsd:annotation>
        <xsd:documentation>

          The metadata-complete attribute defines whether this
          deployment descriptor and other related deployment
          descriptors for this module (e.g., web service
          descriptors) are complete, or whether the class
          files available to this module and packaged with
          this application should be examined for annotations
          that specify deployment information.

          If metadata-complete is set to "true", the deployment
          tool must ignore any annotations that specify deployment
          information, which might be present in the class files
          of the application.

          If metadata-complete is not specified or is set to
          "false", the deployment tool must examine the class
          files of the application for annotations, as
          specified by the specifications.

        </xsd:documentation>
      </xsd:annotation>

    </xsd:attribute>

Cheng

vince kraemer wrote:

> Cheng Fang wrote:
>
>> Pls see inline comments.
>>
>> [snip]
>>
>>> If I had another interface
>>>
>>> @Local
>>> public interface LLStatelessLLocal {
>>> ...
>>> }
>>>
>>> that I wanted to associate with the (original) bean, would I put
>>>
>>> <ejb-jar version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"....>
>>> <enterprise-beans>
>>> <session>
>>> <ejb-name>StatelessL</ejb-name>
>>> <local>ejb3.LLStatelessLLocal</local>
>>> </session>
>>> ....
>>>
>>> or do I need to put in more info than that. bonus q: is the local
>>> interface ejb3.StatelessLLocal still "available".
>>>
>>>
>>>
>> Can't do that. These are component-defining annotations and can't be
>> changed/overridden/augmented by xml descriptor.
>
> But, if I have an annotation free class and interface like
> pojo.MyInterface and pojo.MyClass (where MyClass implements
> MyInterface), can i do something like....
>
> <enterprise-beans>
> <session>
> <ejb-name>IHateMetadata</ejb-name>
> <local>pojo.MyInterface</local>
> <ejb-class>pojo.MyClass</ejb-class>
> </session>
> ....
>
> Thanks,
> vbk
>
>>
>>> thanks,
>>> vbk
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>