• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Multiple Home & env. entities

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
This tiny ad is wafer thin:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic