That is right...

The Counter.jar EJB marks a pool of ids it can deliver, just as the
databases identity column does it to keep performance.

If you need perfectly sequel numbers you have to implement your own EJB to
do so. But then you will get a performance hit on 5-10 inserts a second or
so. When you do the buffering Counter.jar does its quite nice performance :)

And for the comment it cant be right...It is right, this is the way you do
identity columnts in ejb with performance and so on. If you need the
database to do it for you, there is only one choice...That is BMP with the
implementation of post create.

Inserts is generally not as performance critic as selects, since inserts
usually is less data than the selects going through thte databases... That
is why you seldom has to tune an insert :)

Klaus Myrseth

-----Opprinnelig melding-----
Fra: Jeff Schnitzer [mailto:[EMAIL PROTECTED]]
Sendt: 1. februar 2001 03:58
Til: Orion-Interest
Emne: RE: When using autonumber for the primarykey...


>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/orion-interest@orionserver.com/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 ...
>
>
>
>

Reply via email to