Simplified for easy accessibility - there's more to it than this!
To create a row in a table, use the 'create' method of the Home interface.
To update a row in a table, use the 'findByPrimaryKey' method of the Home
interface (giving the primary key). Once you have the EB, you modify the
data using accessors and the changes are persisted to the row. [You may also
use other finder methods to get rows]
I think you have misunderstood EJB - 'create' is only used to create the
persistent data (NOT the object). 'create' is not equivalent to 'new' in
Java terms.
If this is not clear enough, or you have further questions, I suggest you
read the ('reams' of) literature available on the Web - many pointers are
available on the archives. Others have explained this far better than I.
Good luck
tim
> -----Original Message-----
> From: Bo Xu [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, June 22, 2000 2:50 PM
> To: [EMAIL PROTECTED]
> Subject: Re: access data represented by an Entity Bean
>
> Hi Tim Shaw ,
>
> Sorry for bothering you! I have a question about "modifying a row
> created by a EB(entity bean)":
>
> I can use a EB to create a row, but I don't how to modify the same row
> with the same EB
> twice (in another "transaction"). Because in my client software(for
> example, a servlet), when I "call" a method
> of a EB(both CMP or BMP), a new row of data will be created(if PK is
> different), or get a Exception
> (Duplicate PK).
>
>
> >The answer is yes. It is completely allowed to create/access a row using
> >JDBC (or any other method) as well as via EB's.
>
> Does it mean:
> 1. we can modify a row with another EB?(or other SB or ... )?
> 2. or in another "transaction" later , we can modify this row with the
> same EB which create this row ?
>
> So if 2 is possible, would you please tell me how to do it?
>
>
> Thanks in advance!
>
>
>
> Bo
> June 22, 2000
>
This e-mail, and any attachment, is confidential. If you have received it in error,
please delete it from your system, do not use or disclose the information in any way,
and notify me immediately. The contents of this message may contain personal views
which are not the views of the BBC, unless specifically stated.
===========================================================================
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".