Hi all
I have to reopen this discussion :)
I using Bean managed Entity bean with <commit-option>A</commit-option> parameter.
My test looks like:

aEntity = findByPrimaryKey(1);
aEntity.getParam();

aEntity = findByPrimaryKey(1);aEntity.getParam();
aEntity = findByPrimaryKey(1);aEntity.getParam();

Application server function calls:
::ejbFindByPrimaryKey(1)
::ejbActivate()
::ejbLoad()
::getParam()
::ejbStore()

::ejbFindByPrimaryKey(1)::getParam()::ejbStore()

::ejbFindByPrimaryKey(1)::getParam()::ejbStore()

My ejbStore() function has dirty flag where i check if it should be done DB update or not.
But my question is:
Why ejbFindByPrimaryKey(1) function is called every time. It kills performance.
In the ejbFindByPrimaryKey(1) i doing select from the DB - it is not needed.
Why application server cannot check in the pool of the application server for existing entities and return the entity (by primary key) without calling ejbFindByPrimaryKey(1). If I using <commit-option>A</commit-option> parameter such entity cannot dissapier so i think multiple ejbFindByPrimaryKey(1) calls in not needed.
Any thougths about that?
Regards Darius Davidavicius


On Tue, 12 Dec 2000 15:42:09 +0100, Rickard �berg wrote:

>Darius Davidavicius wrote:
>> >That's for a second call to fBPK in the same transaction right?
>>
>> i was just thinking....
>>
>> i hope it works like:
>> 1.
>>
>> Transaction1 -> fBPK -> DataBase calls
>> Transaction1 -> fBPK -> no DataBase calls
>> commit
>
>Correct.
>
>> 2.
>> Transaction1 -> fBPK -> DataBase calls
>> commit;
>> Transaction2 -> fBPK -> no DB calls
>> commit;
>
>Correct.
>
>> 3.
>> Transaction1 -> fBPK -> DataBase calls
>> Transaction2 -> fBPK -> ??? i dont have ideas, it can be DB load; or notFound exception
>> commit 1;
>
>This depends on how the cache is implemented. With the current cache
>(which uses pessimistic locking) you would get no DB calls for TX2.
>
>With an optimistic cache Tx1 and Tx2 would be completely separate so an
>Entity active in Tx1 is not seen by Tx2.
>
>> Transaction2 -> fBPK -> no DB calls
>> commit 2;
>>
>> does it work like i think ?
>
>Yes.
>
>--
>Rickard �berg
>
>Email: [EMAIL PROTECTED]
>
>
>--
>--------------------------------------------------------------
>To subscribe: [EMAIL PROTECTED]
>To unsubscribe: [EMAIL PROTECTED]
>Problems?: [EMAIL PROTECTED]
>

Reply via email to