I am very new to EJBs. I just have a doubt as to, is there a primary key in Stateful EJBs that is used to find out if if an instance exists or not for a particular session. As far as my understanding goes, stateful session beans are associated with sessions. But how does the server know which instance is a session bound it.
Why I am asking all this , is because, I have a method that calls the create of session bean on every page load.passign the same parameter yo hetEJBHome everytime. Now the problem is, after eveery page refresh, a new session bean is formed ans soon the cache is full and it gives a cache full exception. I have the code right below.
Could someone please tell me where my undretsnaing is wronng
What I want to do is, before I call the create method, I want to do a find on wheather an instane exists fir that session and call create only when an instance is not present for that session. Is there a method to do that? Thnaks a lot
posted 12 years ago
You can store the bean reference in your http session. Then pull it back out when you need it. Only create the bean when the user first signs in or as needed if it doesnt exist; depending on how your system works.
Do not threaten THIS beaver! Not even with this tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user