Myls Jeffery wrote:
> We have a requirement for a number of static data types in our project.
> Each type of static data will be provided by a read-only entity bean.  I
> want to ensure that only one instance of an entity bean is created so that
> we do not have multiple entity beans of the same type polling the database
> for the same data.
>
> To accomplish this, I was thinking of creating a PK class for each entity
> bean that no matter what ID you pass to it it will treat it as the same.
> Therefore the EJB server will not create a new instance of the entity bean -
> it will simply return the existing one.


I've done this very thing in the past. Home.findByPrimaryKey() always
ignored the PK that was passed in and instead "found" the same PK every
time. You should be able to do the same thing with Home.create().

In the situation I was in, we needed a "singleton", so this was the
strategy we took. Worked out fine. It was a portable, EJB primary key
generator that was part of the Enterprise Tool Kit.

That's not much information, but I hope it helps.

cheers,
david


--
David Sims             [EMAIL PROTECTED]
Sims Computing, Inc.     www.simscomputing.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to