@Lorne-Kates said in Persisting objects in a database:
And I've never felt right about serializing the object and saving the blob to the db, since I can't query anything.
The easiest approach is to do exactly that, while keeping an extra copy of the fields you need to query over. If you find you need to keep virtually all the fields for querying, might as well keep 'em all (unless you have the odd one that is better done with a big bad serialized blob). The fields to beware of are the ones that have a big graph of things hanging off the back end; if you don't have any of them, the object will map to a table pretty neatly however you do it.
The bigger question is whether or not you use a ORM to do the scut work of mapping.