Fix NPE on merge of entity with transient component (HHH-3868)

A NullPointerException was thrown in StatefulPersistenceContext.proxyFor
when the EntityEntry returned by getEntry was null. The proxyFor method
which takes an EntityPersister simply returns the impl if hasProxy is
false, so this strategy has been copied.

Affected versions:
 * 3.5.6
 * 4.2.0.Final
 * 4.3.6.Final