title: Coding to an interface an issue in using Hibernate ORM with Panache
body: <p>When using hibernate in spring generally we code to an interface like below</p>
  <pre class="lang-java prettyprint-override"><code>public interface UserRepository {
      Collection&lt;User&gt; findByLastName(String lastName) throws DataAccessException;
      //more methods
  }
  
  @Repository
  public class JpaUserRepositoryImpl implements UserRepository {
      @PersistenceContext
      private EntityManager em;
      
      @SuppressWarnings(&quot;unchecked&quot;)
      public Collection&lt;User&gt; findByLastName(String lastName) {
          Query query = this.em.createQuery(&quot;SELECT DISTINCT user FROM User user  WHERE user.lastName LIKE :lastName&quot;);
          query.setParameter(&quot;lastName&quot;, lastName + &quot;%&quot;);
          return query.getResultList();
      }
  }
  @Entity
  @Table(name = &quot;users&quot;)
  public class User {
  ..
  }
  </code></pre>
  <p>How do we do the same in Panache?</p>
  <pre class="lang-java prettyprint-override"><code>public interface UserRepository extends PanacheRepositoryBase&lt;User, Integer&gt; {
  
      Collection&lt;User&gt; findByLastName(String lastName) ;
      //more methods
  }
  
  @ApplicationScoped
  public class JpaUserRepositoryImpl implements UserRepository {
  
      @Inject
      private EntityManager em;
  
      @SuppressWarnings(&quot;unchecked&quot;)
      public Collection&lt;User&gt; findByLastName(String lastName) {
          Query query = this.em.createQuery(&quot;SELECT DISTINCT user FROM User user  WHERE user.lastName LIKE :lastName&quot;);
          query.setParameter(&quot;lastName&quot;, lastName + &quot;%&quot;);
          return query.getResultList();
      }
  }
  </code></pre>
  <p>It throws</p>
  <pre><code>[2] Unsatisfied dependency for type javax.persistence.EntityManager and qualifiers [@Default]
          - java member: org....repository.jpa.JpaUserRepositoryImpl#em
          - declared on CLASS bean [types=[org....repository.jpa.JpaUserRepositoryImpl, org....repository.UserRepository, io.quarkus.hibernate.orm.panache.PanacheRepositoryBase&lt;org.....model.User, java.lang.Integer&gt;, java.lang.Object], qualifiers=[@Default, @Any], target=org.....repository.jpa.JpaUserRepositoryImpl]
  [
  </code></pre>