3 Replies Latest reply on Dec 30, 2005 3:56 AM by Ales Justin

    Injection on server startup

    Aditya Poosarla Newbie

      Hi,

      I am using ejb3. I need to inject references of delegate classes into the ejb so that it can call methods in the delegate. I need this to happen when jboss server start's up.

      Is there any way I can do? I have all my bean definitions in a xml file named beans-ejb.xml.

      I do not use tomcat as the webserver. Jboss is independent and acts as only a applicatiopn server. A beans.ejb3 file with the ejb's, delegates, dao and hibernate mapping files.

      Thanks,
      Aditya.P

        • 1. Re: Injection on server startup
          Ales Justin Master

          What kind of file is this beans-ejb.xml (how are beans defined in it)?

          • 2. Re: Injection on server startup
            Aditya Poosarla Newbie

            here is my bean :

            <beans>
            
             <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
             <property name="driverClassName"><value>oracle.jdbc.driver.OracleDriver</value></property>
             <property name="url"><value>jdbc:oracle:thin:@dev-db.iagr.net:1521:dev</value></property>
             <property name="username"><value>owner</value></property>
             <property name="password"><value>ownerdev</value></property>
             </bean>
            
             <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
             <property name="dataSource"><ref local="dataSource"/></property>
             <property name="mappingResources">
             <list>
             <value>Category.hbm.xml</value>
             </list>
             </property>
             <property name="hibernateProperties">
             <props>
             <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
             <prop key="hibernate.show_sql">true</prop>
             <prop key="hibernate.query.substitutions">true 1, false 0</prop>
             <prop key="hibernate.jdbc.fetch_size">15</prop>
             <prop key="hibernate.jdbc.batch_size">15</prop>
             <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
             <prop key="hibernate.cache.use_query_cache">true</prop>
             </props>
             </property>
             <property name="eventListeners">
             <map>
             <entry key="merge">
             <bean class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener"/>
             </entry>
             </map>
             </property>
             </bean>
            
             <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
             <property name="sessionFactory"><ref local="sessionFactory"/></property>
             </bean>
            
             <bean id="categoryDAO" class="com.rewardtv.rewards.dao.CategoryHibernateDAO">
             <property name="sessionFactory" ref="sessionFactory"/>
             </bean>
            
            </beans>


            • 3. Re: Injection on server startup
              Ales Justin Master

              Ok, you can easily get this objects into EJB's.
              But why would you wan't to force something that ejb3 already supports.

              All this stuff is already integrated into JBossAS + EJB3.

              What you are using comes in handy with just a web container, not so much with a full blown app server.