I am using hibernates entityManager to delete an object. However the object is not getting deleted even after flushing the entityManager. It is getting returned if I do a `find` on it using is id.

Following is what my piece of code looks like:

```
@PersistenceContext(unitName = "registryPU")
private EntityManager em;

public <E> E delete(Class<E> clazz, String id) {
    E en=(E) find(clazz, id);

    if(en != null){
        em.remove(en);
        em.flush();
    }

    en=(E) find(clazz, id);
    assert ( en == null);

    return en;
} 

public <E> E find(Class<E> clazz, String id) {
    return em.find(clazz, id);
}

```

and the persistence.xml is as follows:

```
<persistence-unit name="registryPU"
    transaction-type="JTA">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <validation-mode>CALLBACK</validation-mode>
    <properties>
        <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />
        <property name="hibernate.hbm2ddl.auto" value="create-drop" />
        <property name="hibernate.connection.charSet" value="UTF-8" />
        <property name="hibernate.show_sql" value="true" />
        <property name="hibernate.hbm2ddl.import_files" value="import.sql"/>
        <property name="hibernate.temp.use_jdbc_metadata_defaults" value="false" />
        <property name="hibernate.event.merge.entity_copy_observer" value="allow"/>
        </properties>
    </persistence-unit>

</persistence>

```

This should ideally work fine, but is throwing `java.lang.AssertionError` because of the assert statement. Can someone let me know what is wrong in this and how to avoid it ?