Hello,

With Weblogic unfortunately I'll only be able to test SQL Server/Sybase.
I will be happy to do the test with Oracle as the underlying database if you want.

I have to check the specs, but from what I recall from the EJB Books
I've read, it seems like the proper place to insert to set/get the key
is after ejbCreate but  before ejbPostCreate... Am I wrong in this?
For CMP, the container should create and return the primary key during the ejbCreate invocation. Hence, you are right.

I also have to think about, as Jeremy recommended, generic
methodologies for Key Generation.  As I see it there are two types of
generation we should support - database managed, such as creating a
generic sequence table or calling a key generation stored proc (there
is a common one we use at work for Sybase, as before 12.5 [which we
just upgraded to] there were issues with Identitys and key gap from
what I'm told), and container managed - where we keep a keyset in
memory and generate our own keys.
In the book "EJB Design Patterns", this design is named "Sequence Blocks". The described idea is to front an Entity Bean in charge of the generation of primary keys with a Session Bean, SequenceSessionBean, in charge of the caching of blocks of primary keys.

This approach has some drawbacks; however it is common whatever the underlying datastore.

Based on this idea, another implementation choice could be:

In the ejbCreate method generated by the container, one could invoke the SequenceSessionBean in order to get the next available primary key. The problem is that one needs to access SequenceSessionBean. It means that an ejb-local-ref needs to be defined in the DD, which is not really convenient. However, if one could export implicitely such a reference based on the custom DD, then this approach could be used and could potentially be more portable and generic.

Having not yet (I am late on this side) browse the source code of OpenEJB, I really do not know if it is feasable.

Cheers,
Gianny

_________________________________________________________________
Trouvez l'âme soeur sur MSN Rencontres http://g.msn.fr/FR1000/9551



Reply via email to