Merge pull request #151 from Kozzi11/master

After fixing #146, some tests has not been updated to reflect this fix.
detach fix, npe fix i entitymanager
Merge pull request #153 from asimarslan/entity-manager

detach fix, npe fix in entitymanager
Fix flush remove | update order
when cascade deleting, add condition to ensure iterate over object implements Iterable interface. Add treenode unit test, to test this