This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple Home & env. entities

 
Sri Ram
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
EJB 2.0 spec says :
"If an enterprise bean is deployed multiple times in the same Container, each deployment results in the creation of a distinct home. The Deployer may set different values for the enterprise bean environment
entries for each home."
I got really confused by reading the above lines.
when I deploy my ejb for the first time HOME1 is created and it sets a environment variable envvar to 1 and I realized that I had given a wrong value for my variable so I deply my ejb again in the same container I change the DD to have a new value for my environment variable envvar as 2 HOME2 is created this time

as per the ejb-spec lines in quote above, there will be two Homes HOME1 and HOME2
HOME1 is having an incorrect value for my variable. My question is : How to avoid getting HOME1 ?

Please let me know.
Thanks!
 
John Ip
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not sure whether I truely understand your question. But if you found that you deploy an ejb with the env var you don't want, you can simply undeploy it.
In your code you refer the ejb by their bean name declared in the DD, not the class name of the bean. You deploy the same bean class twice, one named home1 and another named home2, they are consider as two different ejb in the container point of view, though they share the same class. If you lookup "home1" then you get the home interface of home1, and if you lookup home2 then you get the home interface of home2. Since home1 and home2 has no relationship in the container point of view. Therefore there is no such case that you will get a home2 home interface, when you lookup "home1".
Hope this is the answer you are looking for.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic