I'm confused about performing queries with O/R Mappers, when properties don't map directly to database fields.

Cases like:
* calculated fields ( eg person.getAgeOn(today) -> method returns result of calculation, not simple accessor)
* different subclasses implement field differently (some may store it directly, some may calculate it)
* Methods like getZipCode() { return getAddress().getZipCode(); } which access the fields of a member object

Let's say I need to get all people whose age as of today is >18, or all people whose zipcode is 01234.

I can think of two ways:
A) Retrieve all the objects, and run the method on each one.
B) Write special SQL to do the query.

The obvious downside to A is performance.

The obvious downside to B is that it ruins all the benefits of OO encapsulation, demeter, inheritance, etc. I need to incorporate all of that knoweledge into the finder methods. When different subclasses implement the field differently, this gets into some pretty messy SQL as well.

How do you J2EE veterans handle it? How does Hibernate's HQL handle queries on non-accessor fields?