* @param entityManager Entity Manager
* @param name row name
* @throws Exception if a problem occurs
*/
public static void checkInstance(final EntityManager entityManager, final String name) throws Exception{
EBStore store = new EBStore();
store.setId(store.hashCode());
store.setName(name);
entityManager.persist(store);
// flush only if there is a transaction
UserTransaction utx = TransactionHelper.getInternalUserTransaction();
if (utx != null) {
if (utx.getStatus() == Status.STATUS_ACTIVE) {
entityManager.flush();
}
}
if (entityManager.find(EBStore.class, Integer.valueOf(store.hashCode())) == null){
throw new Exception("EBStore was created, but it wasn't found after the commit.");
}
}