Yes ctx.getPrimaryKey() is the reliable method to get the primary key. This
fn . ensures that you get the latest value in synch with database.
Regds
Ashwani
-----Original Message-----
From: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED]]On Behalf Of Guess
Sent: Tuesday, June 26, 2001 9:58 AM
To: [EMAIL PROTECTED]
Subject: necessary to get primary key from entitycontext? (part 2)
I guess I'm not understanding something. Isn't the primary key saved in
the my_primary_key variable below when the ejbCreate is called?
public class myEJB implements EntityBean {
public String my_primary_key;
public myEJBPK ejbCreate(String p_primary_key) { my_primary_key =
p_primary_key; }
// ... more code
}
Then why do we have to use
public void ejbLoad() {
myEJBPK primaryKey = (myEJBPK) ctx.getPrimaryKey();
// .. more jdbc code
statement.setString(1, primaryKey.get_my_primary_key());
}
intead of just doing:
statement.setString(1, my_primary_key); ?
is it necessary to go through the getPrimaryKey() method of the EntityClass
(ctx) ?
----- Original Message -----
From: "Evan Ireland" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, June 25, 2001 11:59 PM
Subject: Re: necessary to get primary key from entitycontext?
> The two places you can best save the key are ejbPostCreate and
ejbActivate.
>
> Guess wrote:
> >
> > hello,
> >
> > i'm writing a BMP ejb. I'm wondering if it's necessary to get
> > the primary key from the EntityContext through the getPrimaryKey()
> > method. Can't I just use the cached primary key in ebjload?
> >
> >
===========================================================================
> > 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".
>
> --
>
____________________________________________________________________________
____
>
> Evan Ireland Sybase EAServer Engineering
[EMAIL PROTECTED]
> Wellington, New Zealand +64 4
934-5856
>
>
===========================================================================
> 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".
>
===========================================================================
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".
===========================================================================
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".