Value objects (Based on #634)

This is PR #634 with the following additional changes:

- Merged into master (fixed some conflict in Metadata classes)
- Support for DQL queries on fields of embedded objects