Let me clarify my previous statement regarding singleton entity beans. This is
definitely possible to do in a spec compliant way. I was only pointing out that
you probably shouldn't assume that findByPrimaryKey will behave exactly like other
finder methods.
I have implemented singletons using BMP. Some access the database, others simply
return "static" data defined in the bean's deployment descriptor. The pattern is
roughly as follows:
1. There is only one primary key value for this entity.
2. ejbCreate should only allow one bean instance. If it already exists, throw
CreateException.
3. ejbFindByPrimaryKey should return the primary key only when called with the
single primary key value.
4. Create another finder, i.e. ejbFindTheInstance(), which returns the single
primary key.
5. Either find the bean using the findTheInstance finder or using findByPrimaryKey
with the single primary key value. I put the key in the home interface to make
this easy.
Hope this makes sense,
Victor
David Sims wrote:
> > 3, I know there were attempts to introduce a singelton bean type. Is it
> > possible toimplement it myself without the support of singelton bean through
> > the app server?
>
> As Evan and Victor recently pointed out, no, you can't without making
> certain assumptions about your app server and machine configuration.
>
> cheers,
> david
===========================================================================
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".