The first query, which corresponds to the findByPrimaryKey, is about
verifying that the identifiers (PK) are valid.
The second query is issued when a business method is called, in order
for the container to load the objet attributes into main memory.
France Telecom R&D is currently working on an adaptable persistence
layer for Java objects called JORM (Java Object Repository Mapping).
JORM will be integrated in a future version of JOnAS, in order to provide
enhanced CMP (including persistent inter-bean references and polymorphism
of entity beans).
The plan is then to develop a caching mechanism (see also Adam McClure's reply to this message) on top of JOnAS + JORM. This cache would indeed limit the waste of resources.
alex
Bryan Field-Elliot wrote:
We use CMP beans extensively, and I am examing the code generated by GenIC
for "JOnAS###Bean###Home" and "JOnAS###Bean###" (where ### is the name of my
bean). This is the code which implements the JEntityHome and JBeanEntity
interfaces.It seems that _two_ queries get issued for every finder method, but it seems
to me that the job can be done with only one. This is a big performance
problem for us, and would be a great performance boost if we could make it
into one query.For example, if I have a table called "Employees" with a primary key "id"
and other fields "name" and "job", then a findByPrimaryKey(100) would result
in the following two queries:select Employees.id from Employees where Employees.id=?
select Employees.id, Employees.name, Employees.job from Employees where
Employees.id=?The first is issued by the Home interface implementation
(pkFindByPrimaryKey), and the second is implemented by the Bean
implementation (loadData).As far as I can see, the first query is a big waste of resources, and pretty
much cuts performance in half. I don't understand why the first query is
executed at all, since it's function (to check whether or not the row
exists) can be performed by the second query just as well.Can someone please explain why it works this way, and if possible, how to
optimize it?Thank you,
Bryan
----
This list is cross-posted to two mail lists. To unsubscribe,
follow the instructions below for the list you subscribed to.
For objectweb.org: send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe ejb-container-group".
For enhydra.org: send email to [EMAIL PROTECTED] and include
in the body of the message "unsubscribe ejb-container-group".
-- Note: the address [EMAIL PROTECTED] should not be used. Instead, please use [EMAIL PROTECTED], or [EMAIL PROTECTED]
