Page 1 of 1

About Question enthuware.oce-ejbd.v6.2.413 :

Posted: Mon Dec 03, 2012 11:39 pm
by rkbansal83
I did not get why option 4 is correct.

@Resource
private Queue omQueue;
By simply specifying this in my code, how do I know which JMS queue I am referring to .
I had to specify @Resource with name attribute only . Please correct me if I am missing something here ?

Re: About Question enthuware.oce-ejbd.v6.2.413 :

Posted: Tue Dec 04, 2012 6:20 am
by admin
In no information is provided, the container injects the object that is most suitable. If there is an ambiguity, an error will occur at deployment time.
HTH,
Paul.

Re: About Question enthuware.oce-ejbd.v6.2.413 :

Posted: Tue Dec 04, 2012 1:01 pm
by rkbansal83
I did not get what do you mean when you said "most suitable object" ?

We can have any number of JMS queues present on JMS provider , how does the EJB container decide the suitability . Please elaborate ?

Also , Can you please tell me if any such thing is specified in EJB specfications ?

Re: About Question enthuware.oce-ejbd.v6.2.413 :

Posted: Sun Dec 16, 2012 8:22 am
by admin
rkbansal83 wrote:I did not get what do you mean when you said "most suitable object" ?

We can have any number of JMS queues present on JMS provider , how does the EJB container decide the suitability . Please elaborate ?

Also , Can you please tell me if any such thing is specified in EJB specfications ?
Well, it depends on the container. Generally, the objects are injected based on their type. In case of JMS destinations, if the container is unable to figure out, it might prevent deployment or it might hookup with an object that you don't want.
The specification does not specify this behavior. That is why it is container specific.

HTH,
Paul.

Re: About Question enthuware.oce-ejbd.v6.2.413 :

Posted: Fri Jun 14, 2013 2:31 pm
by hellovn
Answer (a) @Resource(name="OrderManagerQueue")
public static Queue omQueue

So we can not use static for a queue inject but we can use static for @EJB injection?

Re: About Question enthuware.oce-ejbd.v6.2.413 :

Posted: Thu May 07, 2015 6:58 pm
by himaiMinh
To answer this question:
@Resource(name="OrderManagerQueue")
public static Queue omQueue

So we can not use static for a queue inject but we can use static for @EJB injection?
There is an EJB programming restriction that we should not use declare static field, except static final field.
Correct me if I am wrong.

Re: About Question enthuware.oce-ejbd.v6.2.413 :

Posted: Thu May 07, 2015 8:21 pm
by admin
That is right. static is not allowed. That is why option 1 is incorrect.

Re: About Question enthuware.oce-ejbd.v6.2.413 :

Posted: Wed Jan 20, 2016 3:28 pm
by aazizi.tarik
Hi Paul,

I know that its out of the scope of the exam, but could you tell how we can tell the container wich Queue to use exactly? is there an atttribute for that in the ejb-jar.xml?

Thanks in advance

Re: About Question enthuware.oce-ejbd.v6.2.413 :

Posted: Thu Jan 21, 2016 4:10 am
by admin
Generally, the containers ( such as wsad or weblogic etc) provide a way for the deployer to tie the actual queue available in the container to the names used in the application. They have a UI for doing this.

Re: About Question enthuware.oce-ejbd.v6.2.413 :

Posted: Tue Dec 27, 2016 11:46 pm
by Gerardo
Hi,

¿Is "static" not allowed only for "Queue"?

In the following link there is defined a "ConnectionFactory" and "Queue" using a "static variable":
https://docs.oracle.com/cd/E19798-01/82 ... index.html

@Resource(lookup = "jms/ConnectionFactory")
private static ConnectionFactory connectionFactory;

@Resource(lookup = "jms/Queue")
private static Queue queue;

Thanks in advance

Re: About Question enthuware.oce-ejbd.v6.2.413 :

Posted: Wed Dec 28, 2016 8:10 am
by admin
Beans are not allowed to have static fields. The examples shown in your link are not beans. They are code snippets for some client code.