Hello,
       Had sometime to review the rowid based update code and was wondering whether or not to do a code change for handling updates which happen in the same transaction as the insert. Here is what I found:
 
1. I have a Session Bean fronting an Entity Bean. The methods in the Session bean is have container transaction set to 'RequriesNew' and the methods in the Entity Bean have container transaction set to 'Requires'
2. The business method in the session bean creates an entity bean within the same method.  So I'd assume the call to be like
 
Call ---> [RequiresNew] Start Transaction --> Call create method on Entity Bean --> [Requires] Stick to current transaction --> Call set method on entity bean created --> [Requires] Stick to current transaction --> Commit
 
3. Alright, the way the methods are being called for different commit options are as
 
[Default]  --- Creating Call Now ---
[Default] JDBCCommand Executing: SELECT COUNT(*) FROM itemizedcall WHERE accountnumber=? AND mobilenumber=? AND invoicenumber=? AND itemizedcallnumber=?
[Default] JDBCCommand Executing: INSERT INTO itemizedcall (itemizedcallnumber,callcost,callduration,mobilenumber,accountnumber,invoicenumber,calltype) VALUES (?,?,?,?,?,?,?)
[Default]  --- Post Create for Entity Bean Now ---
[Default]  -- Load Entity --
[Default]  -- Invoke Load  --
[Default]  --- Setting Call Cost Now ---
[Default]  -- Store Entity --
[Default] JDBCCommand Executing: UPDATE itemizedcall SET itemizedcallnumber=?,callcost=?,callduration=?,mobilenumber=?,accountnumber=?,invoicenumber=?,calltype=? WHERE ROWID =?
This basically means that even within the same transaction the rowid will be updated if the client attempts to do an update [or delete].
 
Do we now need to check for rowid being null and falling back to the primary key if it is not? I had written some code for this and was surprised that it was never being called. 
 
If we are happy with this I'd like to commit this to CVS.
 
Regards
 
Vinay
 
 

Reply via email to