Add new test cases to validate nullable and unique field constraints.
Fix connections not released by entity manager.