Annotation « ejb « Java Enterprise Q&A

1. @EJB annotation in clients

Using NetBeans, I do the following in the class containing main(), and it works:

import javax.ejb.EJB;

public class Master {
    TestBeanARemote x;

    public ...

2. Where is the jar file for EJB3 annotations for JBoss 5?

This should be simple, but I'm at a complete loss. I'm working through a tutorial for setting up some MBeans in JBoss 5.0. It has an example like this:

public interface Calculator ...

3. EJB3 Annotation

I am using JBoss 5 GA, I created a test Session bean, and local interface. I have created a servlet client. I tried to inject the interface in the servlet using ...

4. Is it possible to use @EJB annotation to inject EJBs through different servers?

I have 2 session beans, OrderBean and InventoryBean which are deployed at different weblogic servers. The OrderBean needs to access the InventoryBean to check if the supply is sufficient. Currently, I use ...

5. @Local annotation in EJB 3

I have a stateless session bean and a standalone-java-program acting as a client. The bean method executes just fine when the interface is marked @Remote. However,when I mark that interface with ...

6. Injecting a static EJB, nonsense?

I want to write this piece of code :

public class MyEjb
    private static MyOtherEjbWhichIWantStatic myOtherEjb;
It makes sense to me, that I want to inject ...

7. Documenting use of EJB3 annotations within a code base

We have a large code base and I want to generate specific reports on the usage of EJB3 annotations within the code base. The simplest use case is to generate a ...

8. How to send mail via ejb 3.1 annotations based

I am trying to inject javax.mail.session in ejb 3.1 via @Resource without any success, I believe that I miss understood the proper configurations (I want annotations based solution and not XML ...

9. How to mock annotated EJBs?

I googled it already, but seems kinda hard to find topics on mocking dependency injected objects (EJB 3.0).

  public class MyTestBean

10. @Startup annotation does not work

I use the @Startup annotation to set entry point on the deploying process in EJB, but it does not work. See code example below:

public class SchedulerManager {


11. Globally overriding clientBindUrl in EJB3 annotations

I'd like to override the clientBindUrl for my session EJB3s so the IP address is not hardcoded and the ejbs are easier to deploy to the different staging servers.


12. What happens if I remove the @EJB annotation?

I read the article on: Just wondering: What will happen if I remove the @EJB annotation? Regards, Danny

13. mulitple queues in EJB messagedriven annotation

I have 3 queues and these three queues need to be listened by MDBbean and accordingly based on reading input, i will split out the task for each category of input. As ...

14. @EJB annotation

@EJB SomeEJBLocal audit ;
I am wondering if this Annotation @EJB works on all App Servers ? (Assuming that the App Servers do Implement J2EE spec) or does it work only on ...

15. [Study EJB]: annotation type is not applicable to this kind of declaration?

Trying to create the simplest EJB using NetBeans 7.0 and EJB 3 in Action book. Well, firstly I've created an interface:

package study;

public interface NewInterface {
    public void sayHello(String name);
Then, ...

16. JavaEE 6: @EJB(beanInterface="")

Could someone help me understand the use of beanInterface parameter of @EJB annotation in JavaEE 6? I have a situation in which I have an EJB and I want it to be ...

17. does @EJB Annotation work for remote call?

public class Servlet2Stateless extends HttpServlet {

@EJB private HelloUserLocal helloUser;

    public void doGet(HttpServletRequest req, HttpServletResponse resp)

18. Question about javax.ejb.PrePassivate Annotation.

Using this annotation, I may specify a seperate method to the annotated method to fire just before the original method. Does the pre call method have to be within the same ...

19. EJB v3 Annotations question.

When programming an EJBv3 Enterprise JavaBean, I notice that in the javax.ejb.* Annotations package, there is no @Activate() or @Passivate Annotations. Instead, there are interfaces to be implemented, like in the ...

20. Auto Reply: EJB v3 Annotations question.

This is an auto-replied message. I am out of office right now. I will be be back in the office on August 16, 2010. Shreedhar Ganapathy (address-removed) is able to contact ...

21. Webservice filter on OC4j for annotated EJBs

Hi, I have a web application that uses ejbs. The application uses filters defined in the web.xml for security and such on all calls. So far so good. I have one ejb that I'm exposing as a webservice using the @Webservice annotation. The problem I have is that I need have all calls to this webservice go through the servlet filter ...

22. i am new to ejb3.0,Using Entity Annotation type Many to Relation

this is my code class Branding @ManyToMany(mappedBy="branding") public Collection getCustomerBrands() { return customerBrands; } class two CustomerBrandings @ManyToMany @JoinTable(name="Branding", joinColumns=@JoinColumn(name="customerId", referencedColumnName="brandId"), inverseJoinColumns=@JoinColumn(name="brandId", referencedColumnName="brandId")) i am getting error org.hibernate.AnnotationException: A Foreign key refering at org.hibernate.cfg.annotations.TableBinder.bindFk( at org.hibernate.cfg.annotations.CollectionBinder.bindCollectionSecondPass( at org.hibernate.cfg.annotations.CollectionBinder.bindManyToManySecondPass( at org.hibernate.cfg.annotations.CollectionBinder.bindStarToManySecondPass( at org.hibernate.cfg.annotations.CollectionBinder$1.secondPass(CollectionBi at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass at org.hibernate.cfg.Configuration.secondPassCompile( at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationCo at org.hibernate.cfg.Configuration.buildMappings( at org.hibernate.ejb.Ejb3Configuration.buildMappings( at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfi at org.hibernate.ejb.Ejb3Configuration.configure( at org.hibernate.ejb.Ejb3Configuration.configure( at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFacto ...