Jon,

In JDBC when you perform a SQL SELECT you need to test if there is a record
in the resultset returned by calling next(). To apply the same in EJB would
have required us all to test for a null return value from the invocation of
the findByPrimaryKey on the home. I personally would also prefer to know
first off if the object I am trying to access still exists especially if I
am using a PK to obtain a reference to it. The throwing of the exception is
more in line with the fact that it is most likely not the norm.

<vendor>
The Inprise Application Server provides a flag,
ejb.findByPrimaryKeyBehavior, to change the behavior of the cmp engine in
this regard. The values for the flag are:

Verify
=====
This will involve the issuing of a SQL statement similar to SELECT pk FROM
table WHERE pk=pkval. This is the standard behavior.

Load
====
This will still involve the issuing of a SQL statement but this time we will
load the state of the entity bean i.e. SELECT fld1, fld2,.... FROM table
WHERE pk=pkval. The assumption being that usage will follow form the finder
invocation.

None
====
Perform no verification. We will wait until the first business method
invocation resulting in an ejbLoad. In the event the primary key is not
present in the table(s) an exception will be thrown during the
synchonization phase.

</vendor>

regards,

William

-----Original Message-----
From: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED]]On Behalf Of Jon Finanger
Sent: Tuesday, November 21, 2000 7:40 AM
To: [EMAIL PROTECTED]
Subject: findByPrimaryKey spec. question


Hi!
As i understand it the findByPrimaryKey calls ejbLoad using the primarykey
returned by the findByPrimaryKey method.
Well, what's the reason for the spec. saying: "The implementation of the
findByPrimaryKey(primaryKey) method must ensure that the entity object
exists."

Will that say i have to first issue a SELECT... from the database just to
see if the entity exist and then the container invokes the ejbLoad (which
contains the same SELECT)????
If thats the case, isn't that a litte much overhead?

I kind of thought this was what happened:
1: ejbHome calls a entitybean (using ejbObject??)
2: the entitybean returns the pk
3: the ejbHome tries to find a matching entity
4: Assigns the new entity to a ejbObject(creating it?) and returns a ref.

Any light on this one?
Whats happening?

/Jon

===========================================================================
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".

Reply via email to