For this simple case/condition you can solve the problem with a NamedQuery:
SELECT e FROM Entity e WHERE (:age IS NULL) OR (:age IS NOT NULL and e.age=:age)
If you want more complex queries (e.g. where you sort dynamically by the column), I would use Criteria API.