em.getTransaction().begin();
em.persist(hstring);
em.getTransaction().commit();
} catch (Exception ex) {
if (findHstring(hstring.getHstringPK()) != null) {
throw new PreexistingEntityException("Hstring " + hstring + " already exists.", ex);
}
throw ex;
} finally {
if (em != null) {
em.close();