how to generate pk increasement for cmp

Hi,

If the pk is auto-increase by 2, how can I write the ceate() in entity-bean?

I can write a pk_generator, but if server restarts, then the key is going to reset from 1 again.

Also, how the client call this create(), if I don't want the client specify the number of pk?

--

Thanks lots

John

Toronto

[349 byte] By [john_woo_canadaa] at [2007-10-2 11:20:36]
# 1
Hi John,Can you give a little bit more details? Which code auto-increments PKs by 2?Why do you need it that way? What are you trying to accomplish?Thank you,-marina
-marinaa at 2007-7-13 4:20:39 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

>I can write a pk_generator, but if server restarts, then the key is going to reset from 1 again.

One approach is to persist the value generated by pk_generator so you can read it back when server restarts.

You can also use "Automatic Primary Key Generation". That will generate the pk value for you. Please see the developer's guide for more information. http://docs.sun.com/app/docs/doc/819-4721/6n6rrfql4?a=view#beajq

cmp-developera at 2007-7-13 4:20:39 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...