I should have mentioned that the server I am using is WebLogic that
implements a custom READ-ONLY strategy for entity beans.  READ-ONLY entity
beans poll the database at a given time interval for updates.  However, I
only want one instance of the bean to exist per-server/per-cluster otherwise
I will have many beans polling the database many times.

Myles


> -----Original Message-----
> From: Jean-Baptiste Nizet [SMTP:[EMAIL PROTECTED]]
> Sent: 05 December 2000 13:50
> To:   [EMAIL PROTECTED]
> Subject:      Re: Readonly Entity Bean Strategy
>
> David Sims wrote:
>
> > 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.
> >
>
> Maybe I miss something, but if you really implemented a singleton this
> way, then I
> won't ever buy your product :-(
> First of all, EJBs are intended to be distributed. This means that if your
> servers
> are clustered, you can't have a real singleton (only a singleton per VM)
> for all
> your servers. The only way to have a real singleton is to break out of the
> EJB
> model and to implement, for example, a CORBA singleton.
> Second, even if you use a single container, this container might
> instantiate
> several instances of the same entity bean (i.e. the same PK). In fact, all
> the
> servers I've used, except Weblogic, use one instance of the same Entity
> Bean per
> concurrent transaction.
>
> Do I miss something?
>
> JB.
>
> >
> > 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".
>
> --
> Jean-Baptiste Nizet
> [EMAIL PROTECTED]
>
> R&D Engineer, S1 Belgium
> Kleine Kloosterstraat, 23
> B-1932 Sint-Stevens Woluwe
> +32 2 200 45 42
>
> ==========================================================================
> =
> 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".

===========================================================================
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