This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how long can I hold onto a home?

 
paul wheaton
Trailboss
Pie
Posts: 21597
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I now have an entity bean adaptor that will access the high counter entity bean. I've made a static final HighCounterHome object. So this will be used by all ejbCreate methods requiring a new, unique ID.
Will there be any problem in holding on to this home object for, say, weeks at a time?
Will there be any problem in having this one home object be used by, say, hundreds of different entity beans?
 
Jim Baiter
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would take a look at serializing the bean into a handle.
Something like:
Context ctx = new InitialContext();
Object obj = ctx.lookup("com.session.ProductHome");
ProductHome home = (ProductHome)
PortableRemoteObject.narrow(obj,ProductHome.class);
product = home.create();
session.setAttribute("handle", product.getHandle());
handle = (Handle) session.getAttribute("handle");
product = (Product) handle.getEJBObject();
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic