Fixes for Issue#342, added test cases on kundera-core