On Sep 27, Rickard Oberg quoth:

> > We have some CMP beans that generate their own primary keys using sequence
> > numbers, however they aren't acquired from an external source.  What is
> > passed into the ejbCreate methods is simply data to be stored.  It never
> > occured to us that we were doing anything special.  The big difference,
> > however is that the ejbCreate method must return the primary key and since
> > we generate it internally in the method it's there for us to return.
> >
> > IMHO, sounds like BMP is what you need to use.
> 
> Not following .Why is BMP a must? (ie. you can do something similar with
> CMP, just refactor the key creation to a stateless session bean).

If you are using a DB specific feature to generate your primary keys,
unless you invoke jdbc directly in your ejbCreate (thereby making your cmp
bean a de-facto bmp bean) you have no way of knowing what primary key to
return to the container.  While moving the jdbc code to an SSB will avoid
having a hybrid (and noncompliant?) bean, how do you have the container
skip the attempt to insert a record after ejbCreate and only update the
row created by this SSB?

For our application where we internally create our primary keys we aren't
using a database feature to do so.

C=)

--------------------------------------------------------------------------
There are no significant bugs in our released software that any significant 
  number of users want fixed.  -Bill Gates, Focus Magazine, Oct 23, 1995
--------------------------------------------------------------------------
Caskey <caskey*technocage.com>       ///                   TechnoCage Inc.
--------------------------------------------------------------------------
        "Welcome to the slippery slope, here is your handbasket.
             ...say, can you work 70 hours this week?"



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to