Thanks Dion for your quick response.

However your answer is actually the very cause of my confusion.

As far as I can tell, the ejbFind*() methods are called after the
ejbCreate() is invoked. Is that correct? In that case, if cust
already exists (I don't mean _cust_ per se, but the table row that will be
used to fill the EJB's attributes) what's the point of an
INSERT statement within ejbCreate() when it's already there and the
ejbFind*() method can retrieve the existing record?

Does the ejbCreate() method *have* to contain an INSERT statement (for BMP)?
And does the ejbRemove() method have
to contain a DELETE statement?

I know I'm missing something quite logical, and this is making me feel quite
stupid.

Again, thanks for your help on this

Cheers

DJ

Dion Almaer wrote:

  >You are right:

  >ejbCreate() -> SQL INSERT
  >ejbRemove() -> SQL DELETE

  >But you are missing the finders:
  >ejbFind*()  -> SQL SELECT

  >If there already is a "Jones" you go get the Jones:

  >e.g. if the primary key is a string that represents the person:

  >Customer cust = custHome.findByPrimaryKey("Bob Jones");

  >Dion

  > -----Original Message-----
  > From: A mailing list for Enterprise JavaBeans development
  > [mailto:[EMAIL PROTECTED]]On Behalf Of Dane Jones
  > Sent: Saturday, April 14, 2001 9:30 PM
  > To: [EMAIL PROTECTED]
  > Subject: Basic Theory Question
  >
  >
  > Hi
  >
  > I'm pretty new to EJB (as this posting will prove) but I have
  > read up a bit
  > about them and I think I understand most of the basic concepts.
  >
  > I'm having a problem understanding a bit of the logic with regard to
  > Entity Beans, specifically the ejbCreate() and the ejbRemove() methods.
  >
  > Sorry if this goes on a bit, but I want to say how I see it, and I'd
  > really appreciate it if someone could at least point me to where I can
  > find a resource that will clear up my misconceptions.
  >
  > An Entity Bean will usually represent a business object (like a
  > customer, an account, an order etc) that is usually stored in some
  > persistent storage location, such as a database. If that's the case, and
  > this is where I'm getting confused, if the entity already exists (say
  > customer "Jones"), why would you INSERT another "Jones" into the
  > database in the ejbCreate() method, and why would you DELETE customer
  > "Jones" in the ejbRemove() method?
  >
  > This is what I understand is happening in both of these methods. The
  > ejbRemove() DELETEs the underlying data not the bean itself, correct?
  >
  > Please forgive if this is a stupid question, but I can't seem to find an
  > example anywhere that *doesn't* perform both these operations within the
  > respective methods I've mentioned. I just can't get my head
  > around why this
  > would be so. I'm sure I'm missing something incredibly simple, but I
would
  > very much appreciate some elucidation on this.
  >
  > Any help or pointers very much appreciated
  >
  > Cheers
  >
  > DJ





_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to