Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PersistanceContext - Extended Scope

 
Deepika Joshi
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please let me know if following is correct for Extended Scope,

Extended Scope is possible with SFSB (BMT Only),
If I set flush mode to Commit (instead of AUTO),
then until, explicitly - commit, flush or close (to EM) is not done;
Entity is syncronized
but data is not commited to db (what ever I update/ insert, it is in EntityContext not in database until I commit/ flush / close).

 
Ralph Jaus
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Extended Scope is possible with SFSB (BMT Only)
It's also possible for SFSB with CMT (and every application managed entity manager has an persistence context with extended scope).

If I set flush mode to Commit (instead of AUTO),
then until, explicitly - commit, flush or close (to EM) is not done;
Entity is syncronized
but data is not commited to db (what ever I update/ insert, it is in EntityContext not in database until I commit/ flush / close).
Not directly. The behavoir of flush mode COMMIT is rather vague defined: JPA spec 3.2.3 states:
If FlushModeType.COMMIT is specified, flushing will occur at transaction commit; the persistence provider is permitted, but not required, to perform to flush at other times.

Futhermore it's important to know that the result of Query.executeUpdate is undefined using flush mode type COMMIT (see JPA spec 3.6.2):
If FlushModeType.COMMIT is set, the effect of updates made to entities in the persistence context upon queries is unspecified.
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this is a major drawback of ORM - complexity.
 
Mark Garland
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree, although I think it's never going to be easy because of the paradigm mismatch...
 
Deepika Joshi
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot for reply.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic