This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes question 2 HF page 627 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "question 2 HF page 627" Watch "question 2 HF page 627" New topic
Author

question 2 HF page 627

Miki Muzsi
Ranch Hand

Joined: Jun 23, 2003
Posts: 120
Could somebody explain what is the meaning of: "Environment entries can be unique for instances of the same enterprise bean type"

Miki


Miki<br /> <br />SCJP 1.4, SCBCD 1.3
sawan parihar
Ranch Hand

Joined: Aug 24, 2004
Posts: 250
Hello,
All the EJB instances from the same home share the same env-entries. That means "Environment entries can be unique for instances of the same enterprise bean type". If you deploy the same EJB twice then you can have different environment entries for these two ejbs but all the ejb instances from a home will share the same env entries.


hope that helps.


Sawan<br />SCJP,SCWCD,SCBCD<br /> <br />Every exit is an entry somewhere.
Miki Muzsi
Ranch Hand

Joined: Jun 23, 2003
Posts: 120
Then why is the answer for that "not true" in HF.

Miki
sawan parihar
Ranch Hand

Joined: Aug 24, 2004
Posts: 250
Environment entries can be unique for instances of the same enterprise bean type


Hey its tricky. No env entries can;t be unique for the same instances of same EJB. If this was correct that it would mean that all the instances can have different env entries which is not correct.

I read this question twice to understand it.
Miki Muzsi
Ranch Hand

Joined: Jun 23, 2003
Posts: 120
I still don't understnand. What is ment by environment entries? The env entry key (jndi) or value? I read couple of times but still ... I don't understand what he/she wants to say.

Miki
sawan parihar
Ranch Hand

Joined: Aug 24, 2004
Posts: 250

I still don't understnand. What is ment by environment entries? The env entry key (jndi) or value?


Its about value.

Ok will try to help you understand.

Suppose we have env entry define as

<ejb-jar>

<enterprise-beans>

<session>
<ejb-name>MyEJB</ejb-name>
<home>MyHome</home>
<remote></remote>
<ejb-class></ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<env-entry>
<env-entry-name>rate</env-entry-name>
<env-entry-type>java.lang.String</env-entry-type>
<env-entry-value>10</env-entry-value>
</env-entry>
</session>


Now all the instance of MYEJB can acces the rate env entry value and they will get the value as 10{which means its not unique for each instance}. Suppose there are 5 instances of MyEJB all these instances when access the rate variable they will get value as 10 only.

The question says

Environment entries can be unique for instances of the same enterprise bean type.

Whic is not correct as its can't be unique rather it can be unique for different EJB or for the same EJB deployed multiple times. The main point is all ejb instances from the same home will share the same env entry values.

sawan
ShivPrakash Srivastava
Ranch Hand

Joined: Mar 24, 2005
Posts: 88
Hi Sawan,

As far I know env entries are on home and not on bean instance and the scope of env-entries is within the <ejb-name> in which it is declared.I think the env-entries are unique for home.

Am I rite?

Regards
Shiv
sawan parihar
Ranch Hand

Joined: Aug 24, 2004
Posts: 250
Hi Shiv ,
Yes you are right. This is what I wrote in my previous post

"The main point is all ejb instances from the same home will share the same env entry values."
Miki Muzsi
Ranch Hand

Joined: Jun 23, 2003
Posts: 120
sawan, after studying your post I finally got the idea :-). I am definately not native english speaker but I find the formulation at least very strange! Why could't she just say: "Environment entries of the same enterprise bean type can have distinct values" instead of .. "be unique for instances"..

Thanks,

Miki
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
sawan parihar

Thanks you very much, I learned a lot from your explaination. I assume you are all correct on this issue, but I got a different conclusion.

1) "Environment entries can be unique for instances of the same enterprise bean type"
2) "Environment entries can be not unique for instances of the same enterprise bean type"

These above 2 statements are both true, since "can be unique" also means "can be not unique". That is why people get confused.

a) Environment entries are always unique for instances of the same enterprise bean type.
b) Environment entries are always the same for instances of the same enterprise bean type.

The answers for both a) and b) should be false.

I just started to prepare this test. Correct me if I am wrong!
Thanks in Advance!
[ June 27, 2005: Message edited by: Roseanne Zhang ]
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
Miki Muzsi
My guess is you don't have English problems on this question, but the author has English or Formal Logic problems.

Correct me if I am wrong!
Thanks in Advance!
sawan parihar
Ranch Hand

Joined: Aug 24, 2004
Posts: 250
Hello Roseanne ,

1) "Environment entries can be unique for instances of the same enterprise bean type"
2) "Environment entries can not be unique for instances of the same enterprise bean type"


Point first is not correct. In this case we are talking about individual instances of the same ejb and are saying that the environment entries will be unique{means each will get its own env entry values} which is not correct.

Point 2nd is correct.

a) Environment entries are always unique for instances of the same enterprise bean type.
b) Environment entries are always the same for instances of the same enterprise bean type.


In this point b is correct.



My guess is you don't have English problems on this question, but the author has English or Formal Logic problems



When I read this question first I was myself confused but then I realised that its not the question that is wrong . Rather I read it twice and I got it. The question statement is
"Environment entries can be unique for instances of the same enterprise bean type". Now this question appears straight and simple to me.

Anyways the good thing is we are able to answer it correctly.

Thanks.
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
"can not be unique" is not the same as "can be not unique".

I think you altered my statement, and it is not quote of mine.

However, your answer is correct, I understand now. Thanks!
[ June 27, 2005: Message edited by: Roseanne Zhang ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: question 2 HF page 627