class SpellbookDaoImpl extends DaoBaseImpl<Spellbook> implements SpellbookDao {

  @Override
  public Spellbook findByName(String name) {<FILL_FUNCTION_BODY>}

}

    Transaction tx = null;
    Spellbook result;
    try (var session = getSessionFactory().openSession()) {
      tx = session.beginTransaction();
      CriteriaBuilder criteriaBuilder = session.getCriteriaBuilder();
      CriteriaQuery<Spellbook> builderQuery = criteriaBuilder.createQuery(Spellbook.class);
      Root<Spellbook> root = builderQuery.from(Spellbook.class);
      builderQuery.select(root).where(criteriaBuilder.equal(root.get("name"), name));
      Query<Spellbook> query = session.createQuery(builderQuery);
      result = query.uniqueResult();
      tx.commit();
    } catch (Exception e) {
      if (tx != null) {
        tx.rollback();
      }
      throw e;
    }
    return result;
  
<methods>public non-sealed void <init>() ,public void delete(com.iluwatar.servicelayer.spellbook.Spellbook) ,public com.iluwatar.servicelayer.spellbook.Spellbook find(java.lang.Long) ,public List<com.iluwatar.servicelayer.spellbook.Spellbook> findAll() ,public com.iluwatar.servicelayer.spellbook.Spellbook merge(com.iluwatar.servicelayer.spellbook.Spellbook) ,public void persist(com.iluwatar.servicelayer.spellbook.Spellbook) <variables>protected Class<com.iluwatar.servicelayer.spellbook.Spellbook> persistentClass