Named queries support

Creating for early review. Unit tests pending.