> This interests me. I will be doing a project where I
> don't care much
> what the primary keys are, only that they are there
> and are unique
> (obviously). Ideally, I would have the database
> autogenerate a
> sequence of numbers, but there doesn't seem to be a
> way to get the
> Container to do this for me?

Using database for it seems messy for me - you insert
the row, and everything is fine (assumed your sequence
or autonumbering worked), but getting this ID out of
database is not convenient (and highly database
dependent). That's why I prefer to use separate bean
to generate ID's

> Could you describe your sequence generator? It
> sounds like the thing
> that I need.

I posted archive with complete source a week ago on
the list (look in the archive). There is also ejbutil
project on sourceforge
( they also have something like this )


And here is short outline what bean does:

It has primary key ( string ID to locate it ),
it has increment, current value and method getNext()
which advances it. 
Whenever I need an ID, I lookup this bean by primary
key ( I store value of this primary key as String data
in ejb environment ), and then just call getNext()

no magic, just some voodoo :)



=====
Konstantin Priblouda ( ko5tik )    Freelance Software developer
< http://www.pribluda.de > < play java games -> http://www.yook.de >
< render charts online -> http://www.pribluda.de/povray/ >

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to