Child pages
  • Development-Database vs Filesystem

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

An Example:
Say I have a Product entity and want to upload and store product photos: I would create two entities Product and ProductPhoto. I would then relate them with either a toOne or toMany relationship depending on whether I need one or many ProductPhoto objects for each Product object.

Wiki MarkupWith this design pattern fetching Product data doesn't directly load the images. Instead EOF will create faults representing the images.
The image data isn't fetched until the fault is fired by accessing the ProductPhoto fault object. So If you fetch 500 Products and batch them into groups of 10 with the \ [ WODisplayGroup\|WO:Programming__WebObjects-Web Applications-Development-WODisplayGroup\] then your first page would fetch only the first 10 images not the 500 (and only if there is a WOElement? or method that accesses the image data).

This pattern also greatly simplify uploading and storing the images because you can bind the NSData used to upload the image to your ProductPhoto's imageData BLOB.

...