This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes EJB and other Java EE Technologies and the fly likes how long can I hold onto a home? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "how long can I hold onto a home?" Watch "how long can I hold onto a home?" New topic
Author

how long can I hold onto a home?

paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 20542
    ∞

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?

permaculture Wood Burning Stoves 2.0 - 4-DVD set
Jim Baiter
Ranch Hand

Joined: Jan 05, 2001
Posts: 532
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();
 
 
subject: how long can I hold onto a home?