take a look at the primary key generation design pattern on
theserverside.com. it presents a very nice db-independent solution to the
primary key generation problem.
the document can be d/led directly from:
http://www.theserverside.com/resources/review/ejbpatterns-primarykeystrategies-sept3.zi
> On 19 Oct 2001 08:34:47 -0200, Marcus Brito wrote:
>
> >> As an alternative to fetching the parameters from the original definition
> >> as above, you can use
> >>SELECT last_value FROM seqname;
> >> to obtain the last value allocated by any backend.
> >
> >You can't trust this. Perhaps som
not to quibble, but sequences only work if they are (implemented in the
rdbms) to be independent of transaction context. I think the important
point you are making is to get the id before you try to insert the row.
david jencks
On 2001.10.19 11:47:11 -0400 Edward Q. Bridges wrote:
>
> actually
actually, you _don't_ want to use OID's in any form, they are internal
housekeeping numbers that the RDBMS uses, they're really not intended for
application work. besides, you then bind your code to postgres, because it's
platform dependent (analogous to the rowid in oracle). it's also not
guar
> As an alternative to fetching the parameters from the original definition
> as above, you can use
>SELECT last_value FROM seqname;
> to obtain the last value allocated by any backend.
You can't trust this. Perhaps some other process (other bean, other
application, other thread) has alredy m