Your SlideShare is downloading. ×
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
EOEditingContext Best Practices
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

EOEditingContext Best Practices

420

Published on

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
420
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
6
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. EOEditingContext Best PracticesMark RitchieDiamond Lake Consulting Inc.
  • 2. EOF - The Big Picture
  • 3. EOF - The Big Picture magic
  • 4. Relational Database Title Star WOBCategory Drama Studio Mariaʼs Movies
  • 5. Relational Database Title Star WOBCategory Drama Studio Mariaʼs Movies Title EOF Next Gen Category Surreal Studio Mariaʼs Movies
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. 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. EOModel
  • 28. EOF Stack
  • 29. EOF Stack
  • 30. EOF Stack EO EO EO
  • 31. EOF Stack EO EO EOEOModelGroup
  • 32. EOF Stack EO EO EOEOModelGroup EOModel
  • 33. EOF Stack EO EO EOEOModelGroup EOEditingContext EOModel
  • 34. EOF Stack EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator
  • 35. EOF Stack EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabaseContext
  • 36. EOF Stack EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext
  • 37. EOF Stack EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EOAdaptor
  • 38. EOF Stack EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EOAdaptor EOAdaptorContext
  • 39. EOF Stack EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext
  • 40. EOF Stack EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  • 41. EOF Stack EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  • 42. Handling Information EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  • 43. Handling Information EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  • 44. Handling Information EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  • 45. Handling Information EO EO EOEOModelGroup EOEditingContext EOModel plist EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  • 46. Handling Information EO EO EOEOModelGroup EOEditingContext EOModel plist EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  • 47. Handling Information EO EO EOEOModelGroup EOEditingContext EOModel plist EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel sql
  • 48. Handling Information EO EO EOEOModelGroup EOEditingContext EOModel plist EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel dictionaries EOAdaptor EOAdaptorContext EOAdaptorChannel sql
  • 49. Handling Information EO EO EOEOModelGroup EOEditingContext EOModel plist EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel dictionaries EOAdaptor EOAdaptorContext EOAdaptorChannel sql
  • 50. Handling Information EO EO EOEOModelGroup EOEditingContext EOModel plist EOObjectStoreCoordinator EnterpriseObjects EODatabase EODatabaseContext EODatabaseChannel dictionaries EOAdaptor EOAdaptorContext EOAdaptorChannel sql
  • 51. Handling Information EO EO EO EOModelGroup EOEditingContext EOModel plist EOObjectStoreCoordinator EnterpriseObjectsSnapshots EODatabase EODatabaseContext EODatabaseChannel dictionaries EOAdaptor EOAdaptorContext EOAdaptorChannel sql
  • 52. Object Stores EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  • 53. Object Stores EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  • 54. Peer EOEditingContexts EO EO EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  • 55. Peer EOEditingContexts EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  • 56. Peer EOEditingContexts EOEOModelGroup EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  • 57. Peer EOEditingContexts EO EOEOModelGroup EOEditingContext EOEditingContext EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  • 58. Peer EOEditingContexts EO EO EOEOModelGroup EOEditingContext EOEditingContext EOEditingCon EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  • 59. Peer EOEditingContexts EO EOEditingContext EO EO EOEOModelGroup EOEditingContext EOEditingContext EOEditingCon EOModel EOObjectStoreCoordinator EODatabase EODatabaseContext EODatabaseChannel EOAdaptor EOAdaptorContext EOAdaptorChannel
  • 60. Creating peer EC’sEOEditingContext ec = session.defaultEditingContext();EOEditingContext peer = new EOEditingContext();
  • 61. Creating local copiesWhen you have a reference to an EOEnterpriseObject andyou want a local copy:EOEnterpriseObject localObject = EOUtilities.localInstanceOfObject(newEC, remoteObject);
  • 62. Object Stores EO EO EO EOEditingContext EOObjectStoreCoordinator EODatabaseContext
  • 63. Nested EditingContexts EO EO EO EOEditingContext EOEditingContext EOObjectStoreCoordinator EODatabaseContext
  • 64. Back here again? EO EO EO EOEditingContext EOObjectStoreCoordinator EODatabaseContext
  • 65. Multiple Database EO EO EO EOEditingContext EOObjectStoreCoordinatorEODatabaseContext
  • 66. Multiple Database EO EO EO EOEditingContext EOObjectStoreCoordinatorEODatabaseContext EODatabaseContext
  • 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. 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. 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. 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. 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. 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. 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. 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. 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. Looking at the movies Movie title Star WOB Studio name Mariaʼs Movies category Drama income $5 000 000 studio movies
  • 77. A to-many relationship Movie title Star WOB Studio name Mariaʼs Movies category Drama income $5 000 000 studio movies
  • 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. 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. Can you see that? EOAdaptorDebugEnabled Log4j controls Monitor at the database Shark, JProfiler, EOEvents
  • 81. Locking?• Well, you really should however, there’s a better way...
  • 82. ERXEC• Get ERXEC from Project Wonder! End of discussion.
  • 83. Notifications Just give me a shout!
  • 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. Delegation This WILL happen.What SHOULD happen? This DID happen.
  • 86. Delegation editingContextShouldFetchObjects(...) editingContextShouldValidateChanges(...)editingContextShouldUndoUserActionsAfterFailure(...) editingContextShouldInvalidateObject(...) editingContextWillSaveChanges(...)
  • 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. Demo time! Freshness Explorer
  • 89. Review Refaulting isn’t so useful• pending changes are discarded• no notifications• no effect on other EOEditingContexts
  • 90. Review Refresh is the smarter way• the snapshot is updated by fetching from database• existing changes are merged over updated values
  • 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. 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. 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. Q&AMark RitchieDiamond Lake Consulting Inc.

×