title: Spring Data Repository JPA Entity Inheritance Issue: Cannot instantiate abstract class or interface
body: <p>I'm using the below web app stack and when I run my TestNG test and the container gets initialized my test class fails to autowire the ExampleRepository with the below exception.  Any ideas on how to map such a relationship? When I start a jetty web server with the same web application I don't get any startup exceptions, so it could be an issue with AbstractTransactionalTestNGSpringContextTests.</p>
  
  <p><strong>Stack:</strong></p>
  
  <pre><code>    Spring - 3.2.2.RELEASE
      Spring Data - 1.3.0.RELEASE
      Hibernate - 3.6.10.Final
      TestNG - 6.1.1
  </code></pre>
  
  <p><strong>Exception:</strong></p>
  
  <pre><code>Cannot instantiate abstract class or interface: com.test.Example; nested exception is org.hibernate.InstantiationException
  </code></pre>
  
  <p><strong>JPA Entities:</strong></p>
  
  <pre><code>@Entity
  @Table(name = "EXAMPLE")
  @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
  @DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.STRING)
  public abstract class Example {}
  
  
  @Entity
  @DiscriminatorValue("examplea")
  public class ExampleA extends Example {}
  
  @Entity
  @DiscriminatorValue("exampleb")
  public class ExampleB extends Example {}
  </code></pre>
  
  <p><strong>Repository:</strong></p>
  
  <pre><code>public interface ExampleRepository extends JpaRepository&lt;Example, Long&gt; {}
  </code></pre>
  
  <p><strong>TestNG Class:</strong></p>
  
  <pre><code>public class ExampleTest extends AbstractTransactionalTestNGSpringContextTests{
        @Autowired
        private ExampleRepository exampleRepository;
  }
  </code></pre>