EOEditingContext Best        PracticesMark RitchieDiamond Lake Consulting Inc.
EOF - The Big Picture
EOF - The Big Picture     magic
Relational Database  Title      Star WOBCategory      Drama Studio    Mariaʼs Movies
Relational Database  Title      Star WOBCategory      Drama Studio    Mariaʼs Movies               Title        EOF Next G...
Relational Database  Title      Star WOBCategory      Drama Studio    Mariaʼs Movies               Title        EOF Next G...
Relational Database   Title              Star WOB Category     Title    DramaEOF Next Gen  Studio        Mariaʼs Movies   ...
Relational Database          Title              Star WOB        Category     Title    DramaEOF Next Gen         Studio    ...
Relational Database          Title               Star WOB        Category      Title    DramaEOF Next Gen         Studio  ...
Relational Database              Title               Star WOB         Category         Title    DramaEOF Next Gen         ...
Relational Database              Title               Star WOB         Category         Title    DramaEOF Next Gen         ...
Relational Database                  Title        Star WOB                Category                  Title         Drama   ...
Relational Database                  Title        Star WOB                Category                  Title         Drama   ...
Relational Database                 Studio      Mariaʼs Movies                 Studio       Fredʼs FlicksMovie Table  MOVI...
Relational Database              Studio Table                STUDIO_ID         NAME                   42         Mariaʼs M...
Relational Database              Studio Table                STUDIO_ID         NAME                   42         Mariaʼs M...
Relational Database              Studio Table                STUDIO_ID         NAME                   42         Mariaʼs M...
Relational Database              Studio Table                STUDIO_ID         NAME                   42         Mariaʼs M...
Relational Database              Studio Table                STUDIO_ID         NAME                   42         Mariaʼs M...
Relational Database              Studio Table                STUDIO_ID         NAME                   42         Mariaʼs M...
Relational Database              Studio Table                STUDIO_ID         NAME                   42         Mariaʼs M...
Relational Database              Studio Table                STUDIO_ID         NAME                   42         Mariaʼs M...
FetchingMovie Table  MOVIE_ID       TITLE       CATEGORY    STUDIO_ID    12         Star WOB        Drama        42    14 ...
FetchingMovie Table  MOVIE_ID       TITLE       CATEGORY    STUDIO_ID    12         Star WOB        Drama        42    14 ...
Fetching                    title    Star WOB                  category    Drama                   studioMovie Table  MOVI...
What’s an EO?•   An instance of a Java class•   Which inherits from EOEnterpriseObject•   It probably has custom behaviour...
EOModel
EOF Stack
EOF Stack
EOF Stack EO   EO   EO
EOF Stack                EO   EO   EOEOModelGroup
EOF Stack                EO   EO   EOEOModelGroup  EOModel
EOF Stack                EO     EO      EOEOModelGroup     EOEditingContext  EOModel
EOF Stack                 EO      EO      EOEOModelGroup       EOEditingContext  EOModel      EOObjectStoreCoordinator
EOF Stack                 EO      EO      EOEOModelGroup       EOEditingContext  EOModel      EOObjectStoreCoordinator    ...
EOF Stack                     EO      EO      EOEOModelGroup           EOEditingContext  EOModel          EOObjectStoreCoo...
EOF Stack                     EO      EO      EOEOModelGroup           EOEditingContext  EOModel          EOObjectStoreCoo...
EOF Stack                     EO      EO      EOEOModelGroup           EOEditingContext  EOModel          EOObjectStoreCoo...
EOF Stack                     EO      EO      EOEOModelGroup           EOEditingContext  EOModel          EOObjectStoreCoo...
EOF Stack                     EO      EO      EOEOModelGroup           EOEditingContext  EOModel          EOObjectStoreCoo...
EOF Stack                     EO      EO      EOEOModelGroup           EOEditingContext  EOModel          EOObjectStoreCoo...
Handling Information                     EO      EO      EOEOModelGroup           EOEditingContext  EOModel          EOObj...
Handling Information                              EO      EO      EOEOModelGroup                               EOEditingCo...
Handling Information                              EO      EO      EOEOModelGroup                               EOEditingCo...
Handling Information                              EO      EO      EOEOModelGroup                               EOEditingCo...
Handling Information                              EO      EO      EOEOModelGroup                               EOEditingCo...
Handling Information                              EO      EO      EOEOModelGroup                               EOEditingCo...
Handling Information                              EO      EO      EOEOModelGroup                               EOEditingCo...
Handling Information                              EO      EO      EOEOModelGroup                               EOEditingCo...
Handling Information                              EO      EO      EOEOModelGroup                               EOEditingCo...
Handling Information                               EO      EO      EO EOModelGroup                                EOEditin...
Object Stores                     EO      EO      EOEOModelGroup           EOEditingContext  EOModel          EOObjectStor...
Object Stores                     EO      EO      EOEOModelGroup           EOEditingContext  EOModel          EOObjectStor...
Peer EOEditingContexts                     EO      EO      EOEOModelGroup           EOEditingContext  EOModel          EOO...
Peer EOEditingContexts                             EOEOModelGroup           EOEditingContext  EOModel          EOObjectSto...
Peer EOEditingContexts                             EOEOModelGroup           EOEditingContext  EOModel          EOObjectSto...
Peer EOEditingContexts                             EO                     EOEOModelGroup           EOEditingContext       ...
Peer EOEditingContexts                             EO                     EO                                              ...
Peer EOEditingContexts         EO   EOEditingContext             EO                     EO                                ...
Creating peer EC’sEOEditingContext ec = session.defaultEditingContext();EOEditingContext peer = new EOEditingContext();
Creating local copiesWhen you have a reference to an EOEnterpriseObject andyou want a local copy:EOEnterpriseObject localO...
Object Stores   EO      EO      EO     EOEditingContext EOObjectStoreCoordinator    EODatabaseContext
Nested EditingContexts        EO      EO      EO          EOEditingContext          EOEditingContext      EOObjectStoreCoo...
Back here again?     EO      EO      EO       EOEditingContext   EOObjectStoreCoordinator      EODatabaseContext
Multiple Database          EO        EO   EO           EOEditingContext       EOObjectStoreCoordinatorEODatabaseContext
Multiple Database          EO        EO     EO            EOEditingContext        EOObjectStoreCoordinatorEODatabaseContex...
Back to Fetching            title       Star WOB       category           Drama           studioMOVIE_ID               TIT...
Back to Fetching                    Movie            title       Star WOB       category           Drama           studioM...
Back to Fetching                    Movie            title       Star WOB       category           Drama           studioM...
Back to Fetching                    Movie            title       Star WOB       category           Drama           studioM...
Back to Fetching                    Movie            title       Star WOB       category           Drama           studioM...
It’s a relationship                    Movie            title       Star WOB                                              ...
It’s a fault                    Movie            title       Star WOB                                                     ...
The Studio lives!                    Movie            title       Star WOB                                                ...
The Studio lives!                    Movie            title       Star WOB                                                ...
Looking at the movies           Movie   title     Star WOB                               Studio                        nam...
A to-many relationship           Movie   title     Star WOB                               Studio                        na...
A to-many relationship           Movie   title     Star WOB                               Studio                        na...
Don’t load them all•   Faulting limits the number of objects fetched•   We lazily load objects, as we need them•   The EOM...
Can you see that?  EOAdaptorDebugEnabled       Log4j controls   Monitor at the database  Shark, JProfiler, EOEvents
Locking?•   Well, you really should however, there’s a    better way...
ERXEC•   Get ERXEC from Project Wonder!           End of discussion.
Notifications Just give me a shout!
Notifications•   These allow a single sender to broadcast    notices that certain events have occured•   There can be multi...
Delegation  This WILL happen.What SHOULD happen?  This DID happen.
Delegation        editingContextShouldFetchObjects(...)       editingContextShouldValidateChanges(...)editingContextShould...
DelegationeditingContextShouldMergeChangesForObject(...)•   triggered by ObjectsChangedInStoreNotification•   if implemente...
Demo time! Freshness Explorer
Review               Refaulting isn’t so useful•   pending changes are discarded•   no notifications•   no effect on other ...
Review              Refresh is the smarter way•   the snapshot is updated by fetching from database•   existing changes ar...
Review                 Invalidate is brute force•   invalidating effect the entire stack•   all pending changes in all EOE...
Review               recovering from invalidate•   left on their own, faults can be VERY inefficient•   best to selectively...
Review        EOEditingContext’s Fetch timestamp•   the default might not be what you want•   default value is 1 hour prio...
Q&AMark RitchieDiamond Lake Consulting Inc.
EOEditingContext Best Practices
Upcoming SlideShare
Loading in …5
×

EOEditingContext Best Practices

664 views

Published on

Published in: Technology, Business
  • Be the first to comment

EOEditingContext Best Practices

  1. 1. EOEditingContext Best PracticesMark RitchieDiamond Lake Consulting Inc.
  2. 2. EOF - The Big Picture
  3. 3. EOF - The Big Picture magic
  4. 4. Relational Database Title Star WOBCategory Drama Studio Mariaʼs Movies
  5. 5. Relational Database Title Star WOBCategory Drama Studio Mariaʼs Movies Title EOF Next Gen Category Surreal Studio Mariaʼs Movies
  6. 6. Relational Database Title Star WOBCategory Drama Studio Mariaʼs Movies Title EOF Next Gen Category Surreal Studio Mariaʼs Movies Title The Player Category Comedy Studio Fredʼs Flicks
  7. 7. Relational Database Title Star WOB Category Title DramaEOF Next Gen Studio Mariaʼs Movies Category Title Surreal The Player Studio Category Movies Mariaʼs Comedy Studio Fredʼs Flicks
  8. 8. Relational Database Title Star WOB Category Title DramaEOF Next Gen Studio Mariaʼs Movies Category Title Surreal The Player Studio Category Movies Mariaʼs Comedy Studio Fredʼs FlicksMovie Table
  9. 9. Relational Database Title Star WOB Category Title DramaEOF Next Gen Studio Mariaʼs Movies Category Title Surreal The Player Studio Category Movies Mariaʼs Comedy Studio Fredʼs FlicksMovie Table TITLE CATEGORY Star WOB Drama EOF Next Gen Surreal The Player Comedy
  10. 10. Relational Database Title Star WOB Category Title DramaEOF Next Gen Studio Mariaʼs Movies Category Title Surreal The Player Studio Category Movies Mariaʼs Comedy Studio Fredʼs FlicksMovie Table MOVIE_ID TITLE CATEGORY 12 Star WOB Drama 14 EOF Next Gen Surreal 27 The Player Comedy
  11. 11. Relational Database Title Star WOB Category Title DramaEOF Next Gen Studio Mariaʼs Movies Category Title Surreal The Player Studio Category Movies Mariaʼs Comedy Studio Fredʼs FlicksMovie Table MOVIE_ID TITLE CATEGORY 12 Star WOB Drama 14 EOF Next Gen Surreal 27 The Player Comedy
  12. 12. Relational Database Title Star WOB Category Title Drama EOF Next Gen Studio Category Mariaʼs Movies Surreal Title The Player Studio Mariaʼs Movies Category Comedy Studio Fredʼs FlicksMovie Table MOVIE_ID TITLE CATEGORY 12 Star WOB Drama 14 EOF Next Gen Surreal 27 The Player Comedy
  13. 13. Relational Database Title Star WOB Category Title Drama The Player Studio Category Mariaʼs Movies Comedy Studio Fredʼs FlicksMovie Table MOVIE_ID TITLE CATEGORY 12 Star WOB Drama 14 EOF Next Gen Surreal 27 The Player Comedy
  14. 14. Relational Database Studio Mariaʼs Movies Studio Fredʼs FlicksMovie Table MOVIE_ID TITLE CATEGORY 12 Star WOB Drama 14 EOF Next Gen Surreal 27 The Player Comedy
  15. 15. Relational Database Studio Table STUDIO_ID NAME 42 Mariaʼs Movies 69 Fredʼs FlicksMovie Table MOVIE_ID TITLE CATEGORY 12 Star WOB Drama 14 EOF Next Gen Surreal 27 The Player Comedy
  16. 16. Relational Database Studio Table STUDIO_ID NAME 42 Mariaʼs Movies 69 Fredʼs FlicksMovie Table MOVIE_ID TITLE CATEGORY 12 Star WOB Drama 14 EOF Next Gen Surreal 27 The Player Comedy
  17. 17. Relational Database Studio Table STUDIO_ID NAME 42 Mariaʼs Movies 69 Fredʼs FlicksMovie Table MOVIE_ID TITLE CATEGORY 12 Star WOB Drama 14 EOF Next Gen Surreal 27 The Player Comedy
  18. 18. Relational Database Studio Table STUDIO_ID NAME 42 Mariaʼs Movies 69 Fredʼs FlicksMovie Table MOVIE_ID TITLE CATEGORY STUDIO_ID 12 Star WOB Drama 14 EOF Next Gen Surreal 27 The Player Comedy
  19. 19. Relational Database Studio Table STUDIO_ID NAME 42 Mariaʼs Movies 69 Fredʼs FlicksMovie Table MOVIE_ID TITLE CATEGORY STUDIO_ID 12 Star WOB Drama 42 14 EOF Next Gen Surreal 27 The Player Comedy
  20. 20. Relational Database Studio Table STUDIO_ID NAME 42 Mariaʼs Movies 69 Fredʼs FlicksMovie Table MOVIE_ID TITLE CATEGORY STUDIO_ID 12 Star WOB Drama 42 14 EOF Next Gen Surreal 27 The Player Comedy
  21. 21. Relational Database Studio Table STUDIO_ID NAME 42 Mariaʼs Movies 69 Fredʼs FlicksMovie Table MOVIE_ID TITLE CATEGORY STUDIO_ID 12 Star WOB Drama 42 14 EOF Next Gen Surreal 42 27 The Player Comedy
  22. 22. Relational Database Studio Table STUDIO_ID NAME 42 Mariaʼs Movies 69 Fredʼs FlicksMovie Table MOVIE_ID TITLE CATEGORY STUDIO_ID 12 Star WOB Drama 42 14 EOF Next Gen Surreal 42 27 The Player Comedy 69
  23. 23. FetchingMovie Table MOVIE_ID TITLE CATEGORY STUDIO_ID 12 Star WOB Drama 42 14 EOF Next Gen Surreal 42 27 The Player Comedy 69
  24. 24. FetchingMovie Table MOVIE_ID TITLE CATEGORY STUDIO_ID 12 Star WOB Drama 42 14 EOF Next Gen Surreal 42 27 The Player Comedy 69
  25. 25. Fetching title Star WOB category Drama studioMovie Table MOVIE_ID TITLE CATEGORY STUDIO_ID 12 Star WOB Drama 42 14 EOF Next Gen Surreal 42 27 The Player Comedy 69
  26. 26. What’s an EO?• An instance of a Java class• Which inherits from EOEnterpriseObject• It probably has custom behaviour• It’s uniquely identified by it’s GlobalID• Typically defined by the EOModel
  27. 27. EOModel
  28. 28. EOF Stack
  29. 29. EOF Stack
  30. 30. EOF Stack EO EO EO
  31. 31. EOF Stack EO EO EOEOModelGroup
  32. 32. EOF Stack EO EO EOEOModelGroup EOModel
  33. 33. EOF Stack EO EO EOEOModelGroup EOEditingContext EOModel
  34. 34. EOF Stack EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator
  35. 35. EOF Stack EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabaseContext
  36. 36. EOF Stack EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext
  37. 37. EOF Stack EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EOAdaptor
  38. 38. EOF Stack EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EOAdaptor EOAdaptorContext
  39. 39. EOF Stack EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext
  40. 40. EOF Stack EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  41. 41. EOF Stack EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  42. 42. Handling Information EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  43. 43. Handling Information EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  44. 44. Handling Information EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  45. 45. Handling Information EO EO EOEOModelGroup EOEditingContext EOModel plist EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  46. 46. Handling Information EO EO EOEOModelGroup EOEditingContext EOModel plist EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  47. 47. Handling Information EO EO EOEOModelGroup EOEditingContext EOModel plist EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel sql
  48. 48. Handling Information EO EO EOEOModelGroup EOEditingContext EOModel plist EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel dictionaries EOAdaptor EOAdaptorContext EOAdaptorChannel sql
  49. 49. Handling Information EO EO EOEOModelGroup EOEditingContext EOModel plist EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel dictionaries EOAdaptor EOAdaptorContext EOAdaptorChannel sql
  50. 50. Handling Information EO EO EOEOModelGroup EOEditingContext EOModel plist EOObjectStoreCoordinator EnterpriseObjects EODatabase EODatabaseContext EODatabaseChannel dictionaries EOAdaptor EOAdaptorContext EOAdaptorChannel sql
  51. 51. Handling Information EO EO EO EOModelGroup EOEditingContext EOModel plist EOObjectStoreCoordinator EnterpriseObjectsSnapshots EODatabase EODatabaseContext EODatabaseChannel dictionaries EOAdaptor EOAdaptorContext EOAdaptorChannel sql
  52. 52. Object Stores EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  53. 53. Object Stores EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  54. 54. Peer EOEditingContexts EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  55. 55. Peer EOEditingContexts EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  56. 56. Peer EOEditingContexts EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  57. 57. Peer EOEditingContexts EO EOEOModelGroup EOEditingContext EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  58. 58. Peer EOEditingContexts EO EO EOEOModelGroup EOEditingContext EOEditingContext EOEditingCon EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  59. 59. Peer EOEditingContexts EO EOEditingContext EO EO EOEOModelGroup EOEditingContext EOEditingContext EOEditingCon EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  60. 60. Creating peer EC’sEOEditingContext ec = session.defaultEditingContext();EOEditingContext peer = new EOEditingContext();
  61. 61. Creating local copiesWhen you have a reference to an EOEnterpriseObject andyou want a local copy:EOEnterpriseObject localObject = EOUtilities.localInstanceOfObject(newEC, remoteObject);
  62. 62. Object Stores EO EO EO EOEditingContext EOObjectStoreCoordinator EODatabaseContext
  63. 63. Nested EditingContexts EO EO EO EOEditingContext EOEditingContext EOObjectStoreCoordinator EODatabaseContext
  64. 64. Back here again? EO EO EO EOEditingContext EOObjectStoreCoordinator EODatabaseContext
  65. 65. Multiple Database EO EO EO EOEditingContext EOObjectStoreCoordinatorEODatabaseContext
  66. 66. Multiple Database EO EO EO EOEditingContext EOObjectStoreCoordinatorEODatabaseContext EODatabaseContext
  67. 67. Back to Fetching title Star WOB category Drama studioMOVIE_ID TITLE CATEGORY STUDIO_ID 12 Star WOB Drama 42 14 EOF Next Gen Surreal 42
  68. 68. Back to Fetching Movie title Star WOB category Drama studioMOVIE_ID TITLE CATEGORY STUDIO_ID 12 Star WOB Drama 42 14 EOF Next Gen Surreal 42
  69. 69. Back to Fetching Movie title Star WOB category Drama studioMOVIE_ID TITLE CATEGORY STUDIO_ID 12 Star WOB Drama 42 14 EOF Next Gen Surreal 42
  70. 70. Back to Fetching Movie title Star WOB category Drama studioMOVIE_ID TITLE CATEGORY STUDIO_ID 12 Star WOB Drama 42 14 EOF Next Gen Surreal 42 STUDIO_ID TITLE CATEGORY 42 Mariaʼs Movies $5 000 000
  71. 71. Back to Fetching Movie title Star WOB category Drama studioMOVIE_ID TITLE CATEGORY STUDIO_ID 12 Star WOB Drama 42 14 EOF Next Gen Surreal 42 STUDIO_ID TITLE CATEGORY 42 Mariaʼs Movies $5 000 000
  72. 72. It’s a relationship Movie title Star WOB Studio name Mariaʼs Movies category Drama income $5 000 000 studio moviesMOVIE_ID TITLE CATEGORY STUDIO_ID 12 Star WOB Drama 42 14 EOF Next Gen Surreal 42 STUDIO_ID TITLE CATEGORY 42 Mariaʼs Movies $5 000 000
  73. 73. It’s a fault Movie title Star WOB Studio name Mariaʼs Movies category Drama income $5 000 000 studio moviesMOVIE_ID TITLE CATEGORY STUDIO_ID 12 Star WOB Drama 42 14 EOF Next Gen Surreal 42 STUDIO_ID TITLE CATEGORY 42 Mariaʼs Movies $5 000 000
  74. 74. The Studio lives! Movie title Star WOB Studio name Mariaʼs Movies category Drama income $5 000 000 studio moviesMOVIE_ID TITLE CATEGORY STUDIO_ID 12 Star WOB Drama 42 14 EOF Next Gen Surreal 42 STUDIO_ID TITLE CATEGORY 42 Mariaʼs Movies $5 000 000
  75. 75. The Studio lives! Movie title Star WOB Studio name Mariaʼs Movies category Drama income $5 000 000 studio moviesMOVIE_ID TITLE CATEGORY STUDIO_ID 12 Star WOB Drama 42 14 EOF Next Gen Surreal 42 STUDIO_ID TITLE CATEGORY 42 Mariaʼs Movies $5 000 000
  76. 76. Looking at the movies Movie title Star WOB Studio name Mariaʼs Movies category Drama income $5 000 000 studio movies
  77. 77. A to-many relationship Movie title Star WOB Studio name Mariaʼs Movies category Drama income $5 000 000 studio movies
  78. 78. A to-many relationship Movie title Star WOB Studio name Mariaʼs Movies category Drama income $5 000 000 studio movies Movie Movie
  79. 79. Don’t load them all• Faulting limits the number of objects fetched• We lazily load objects, as we need them• The EOModel can define the number to batch fault• Separate settings for to-one and to-many faults• Deferred faulting provides even more lazzzzzyness
  80. 80. Can you see that? EOAdaptorDebugEnabled Log4j controls Monitor at the database Shark, JProfiler, EOEvents
  81. 81. Locking?• Well, you really should however, there’s a better way...
  82. 82. ERXEC• Get ERXEC from Project Wonder! End of discussion.
  83. 83. Notifications Just give me a shout!
  84. 84. Notifications• These allow a single sender to broadcast notices that certain events have occured• There can be multiple listeners who subscribe to the notifications• Notification can carry custom UserInfo dict• There is no opportunity to change behaviour
  85. 85. Delegation This WILL happen.What SHOULD happen? This DID happen.
  86. 86. Delegation editingContextShouldFetchObjects(...) editingContextShouldValidateChanges(...)editingContextShouldUndoUserActionsAfterFailure(...) editingContextShouldInvalidateObject(...) editingContextWillSaveChanges(...)
  87. 87. DelegationeditingContextShouldMergeChangesForObject(...)• triggered by ObjectsChangedInStoreNotification• if implemented, the EOEditingContext will call it• the default behaviour is to merge the changes• ONLY record values in this method• make changes in editingContextDidMergeChanges(...)
  88. 88. Demo time! Freshness Explorer
  89. 89. Review Refaulting isn’t so useful• pending changes are discarded• no notifications• no effect on other EOEditingContexts
  90. 90. Review Refresh is the smarter way• the snapshot is updated by fetching from database• existing changes are merged over updated values
  91. 91. Review Invalidate is brute force• invalidating effect the entire stack• all pending changes in all EOEditingContexts are lost• the snapshots are discarded since the EO’s went away• database trip needed when fault is touched• perhaps many, many database trips unless steps are taken
  92. 92. Review recovering from invalidate• left on their own, faults can be VERY inefficient• best to selectively fetch EO’s you’ll need• use prefetching paths for even more EO’s all at once
  93. 93. Review EOEditingContext’s Fetch timestamp• the default might not be what you want• default value is 1 hour prior to context creation• Never changed unless you do it
  94. 94. Q&AMark RitchieDiamond Lake Consulting Inc.

×