t-666, fixed the entity mapping and repo code
Merge branch 't666' into resolved