• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Qns about Finder in EJB2.0

 
Shaival Satyarthi
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Please let me know about this.

Assumptions :
In DB,we have a Row in a table.
the Row contains,ID 'x' and the Date (e.g.)
currently,no data is there in Date field

STEPS:
1)So,now in code,i do a finder for a id "x" and get the ejbObject representing this row.But there is no date.
2)Now I update the DB for id'x',with date '12/12/1990' (e.g.)
3)then again i call finder for this id 'x'

Scenarios :
Scenario 1) All these 3 steps were in same Txn
Scenario 2) Step 1 and 3 are in Txn A(e.g. Required) and step 2 was in txn B(e.g. RequiresNew)

QUESTION :
Please let me know,how the behaviour will differ in both these Scenaios
and will the Date appear or not in second finder ?

Regards
Shaival
 
prashanth kumar
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Shaival Satyarthi:
Hi,

Please let me know about this.

Assumptions :
In DB,we have a Row in a table.
the Row contains,ID 'x' and the Date (e.g.)
currently,no data is there in Date field

STEPS:
1)So,now in code,i do a finder for a id "x" and get the ejbObject representing this row.But there is no date.
2)Now I update the DB for id'x',with date '12/12/1990' (e.g.)
3)then again i call finder for this id 'x'

Scenarios :
Scenario 1) All these 3 steps were in same Txn

>>>>This means that steps 1,2 and 3 either works/doesnt work...either commits as a whole OR rollbacks as a whole...


Scenario 2) Step 1 and 3 are in Txn A(e.g. Required) and step 2 was in txn B(e.g. RequiresNew)

>>Assuming that calling client is in a transaction,this means that steps 2 and 3 are in one transaction and step 1 is in different transaction..So 2 and 3 works as a whole..If 3 throws an exception,the stuff done in step 2 will rollback...



QUESTION :
Please let me know,how the behaviour will differ in both these Scenaios
and will the Date appear or not in second finder ?

Regards
Shaival
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic