File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how long can I hold onto a home?

 
paul wheaton
Trailboss
Pie
Posts: 21183
Firefox Browser IntelliJ IDE Java
  • 0
  • 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
  • 0
  • 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