Check out something like the hi/low generator pattern. I think it's more
likely used with session beans, but each instance takes a high value from a
central store like a database and then generates a low value for each
request. When you put together the two values it's unique.
If you use BMP you can just do the sequence stuff in ejbCreate no muss no
fuss, but of course there are other issues when making the switch from CMP
-> BMP.
Cheers
-----Original Message-----
From: John Bateman
To: [EMAIL PROTECTED]
Sent: 7/31/01 9:48 AM
Subject: Re: Sequence no generation
Hi
Just read Avi's post on "Do BMP's buy you anything".
I think I get it now, the sharing model of the "seq number" is what
actually
makes is infeasible to use EB's because multiple calls to 'get next
number'
could return the same number since the Entity Bean isn't 'shared' but
has a
pool. I.E. Each call has a handle to some object in the pool. these
object
would represent the same state of the 'seq numbers'.
>
> Hi
>
> How does a stateless Session bean guarantee that the data is
> always fresh?
> Also since these sequence numbers are pretty much the
> intermediate state of
> a data model between calls, doesn't this just scream "Entity Bean"?
>
> I know the following is an ongoing discussion on the net,
> but, I'll take the
> angle that I could use simple CMP and some sort of a
> singleton handing out
> the 'next' number. Even large requests would be minimal to
> 'get acctountNo +
> 1' and then set the change to the entity bean.
>
> Using this 'design' wouldn't I almost be guaranteed that the
> bean always has
> fresh data? Additionally the 'new' seq number could be mapped to the
> database at any time so that any external acces to the DB
> could use the same
> numbers too?
>
> I'm relatively new to the proper in's and out's of this
> architecture so I
> tend to have some misconceptions about it's abilities. Please
> excuse me if
> I'm overlooking some simple point here.
>
> (As an aside I'm not even looking at the effects of all this
> in a clustered
> environment.. which I'm learning seems to be a headache to
> maintain data
> state.)
>
> Thanks.
========================================================================
===
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".