EntityPersister persister = factory.getEntityPersister( associatedEntityName );
StringBuffer result = new StringBuffer().append( associatedEntityName );
if ( persister.hasIdentifierProperty() ) {
final EntityMode entityMode = persister.guessEntityMode( value );
final Serializable id;
if ( entityMode == null ) {
if ( isEmbeddedInXML ) {
throw new ClassCastException( value.getClass().getName() );
}