fixed problem "object references an unsaved transient instance - save the transient instance before flushing"

resolves #138