>From looking at the source, counter.jar only writes to the database for
every ten keys generated. With pessimistic concurrency, loads do not
occur for each use.
Here's the relevant code from CounterEJB.java:
public String ejbCreate(String name)
throws CreateException
{
this.name = name;
currentID = 1L;
currentPrivateID = 0L;
return null;
}
public long getNextID()
{
if(currentPrivateID == 0L)
currentPrivateID = currentID;
for(; currentPrivateID >= currentID; currentID += 10L);
return currentPrivateID++;
}
currentPrivateID is not an entity field.
I don't think there are any issues posting the code because of this
comment:
http://www.mail-archive.com/[email protected]/msg01478.html
Jeff
>-----Original Message-----
>From: Angus Mark [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, January 31, 2001 10:01 AM
>To: Orion-Interest
>Subject: RE: When using autonumber for the primarykey...
>
>
>
>I'm using the counter.jar which is fine, but does it have any impact on
>performance ?
>
>Ok, the EJB spec doesn't support id fields, but surely now for every
>create() I'm actually doing twice the work - ie: creating and
>loading the
>counter entity bean and the entity bean using the counter?
>That can't be
>right ...
>
>
>
>