Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

HFE + SessionSynchronization

 
cyril vidal
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I just would like to mention something concerning SessionSynchronization that is perhaps not enough detailed in HFE (cf p.511-512-513) or not enough clear - to my sense.
The point is the following: if the the transaction won't commit, don't forget that method beforeCompletion won't be called!
So, by example, if a system exception is thrown in the bean, you will have the following sequence:
afterBegin() -> business method, ->afterCompletion(false).
That's only in the case of sucessfull commit that the beforeCompletion will be called before afterCompletion! This method will usually be used to write any cached updates to the database.
cf spec p.78.
Regards,
Cyril.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!