• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

PersistanceContext - Extended Scope

 
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).

 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think this is a major drawback of ORM - complexity.
 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot for reply.
 
reply
    Bookmark Topic Watch Topic
  • New Topic