Fixed querying on entity with composite-key.

Signed-off-by: Paulo Pires <pjpires@gmail.com>