Fixes for #614 and added testcases
Merge branch 'trunk' of https://github.com/impetus-opensource/Kundera into trunk