4 Replies Latest reply on Nov 4, 2010 7:49 AM by csenes csenes

    I wanna ask a question about @in annotation

    csenes csenes Newbie

      when I use @In annotation on my bean ,Do I have to write any code on ejb-jar.xml


      I use ejb-3.0

        • 1. Re: I wanna ask a question about @in annotation
          Leo van den berg Master

          Hi,


          make sure you have the seam-interceptor configured. This can be done on every bean, but it is much easier to do this on the ejb-jar.xml as follows:




          <?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" 
                   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
                   version="3.0">
             <interceptors>
                <interceptor>
                   <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
                </interceptor>
             </interceptors>
             <assembly-descriptor>
                <interceptor-binding>
                   <ejb-name>*</ejb-name>
                   <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
                </interceptor-binding>
             </assembly-descriptor>
          </ejb-jar>



          You also need to define the JNDI-name for each bean, but that is equally easy in components.xml:





          <core:init jndi-pattern="[YOUR_EAR_NAME]/#{ejbName}/local" />



          Hopefully helpful for you,


          Leo









          • 2. Re: I wanna ask a question about @in annotation
            csenes csenes Newbie

            thanks for reply leo ,But I tell different thing , I gave an example above


            I wrote those codes before,but I am not sure to need writing this,



            my bean(only inject part)




            @Out(required = false)
                 @In(required=false,create = true)
                 IDokumanHome<Dokuman> dokumanHome;
            
                 @In(required=false,create = true)
                 @Out(required = false)
                 ILogoToFolderHome<LogoToFolder> logoToFolderHome;
            
                 @In(required=false,create = true)
                 @Out(required = false)
                 IUploadeddocumentHome<UploadedDocument> uploadeddocumentHome;
                 
                 @In(required = false,create = true)
                 @Out(required = false)
                 LogoToFolder logo;







            ejb-jar.xml(only specific part)





            <session>
                           <ejb-name>LogoUploadBean</ejb-name>
                           <ejb-class>org.domain.kaliteyonsist.session.LogoUploadBean</ejb-class>
                           <ejb-local-ref>
                                <ejb-ref-name>kaliteyonsist/DokumanHome/local</ejb-ref-name>
                                <ejb-ref-type>Session</ejb-ref-type>
                                <local>org.domain.kaliteyonsist.session.IDokumanHome</local>
                           </ejb-local-ref>
                           <ejb-local-ref>
                                <ejb-ref-name>kaliteyonsist/LogoToFolderHome/local</ejb-ref-name>
                                <ejb-ref-type>Session</ejb-ref-type>
                                <local>org.domain.kaliteyonsist.session.ILogoToFolderHome</local>
                           </ejb-local-ref>
                           <ejb-local-ref>
                                <ejb-ref-name>kaliteyonsist/UploadeddocumentHome/local</ejb-ref-name>
                                <ejb-ref-type>Session</ejb-ref-type>
                                <local>org.domain.kaliteyonsist.session.IUploadeddocumentHome</local>
                           </ejb-local-ref>
            
                           <ejb-local-ref>
                                <ejb-ref-name>kaliteyonsist/DokumanYonetimPanelBean/local</ejb-ref-name>
                                <ejb-ref-type>Session</ejb-ref-type>
                                <local>org.domain.kaliteyonsist.session.DokumanYonetimPanel</local>
                           </ejb-local-ref>
                      </session>



            • 3. Re: I wanna ask a question about @in annotation
              Leo van den berg Master

              Hi,


              if you define the interceptor as stated before, you don't need to define the beans in ejb-local-ref, unless in other parts of your application you are using these beans in the EJB-3 only way.


              Leo

              • 4. Re: I wanna ask a question about @in annotation
                csenes csenes Newbie

                thanks for reply ,I appreciated for reply