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.
Stack:
Spring - 3.2.2.RELEASE
Spring Data - 1.3.0.RELEASE
Hibernate - 3.6.10.Final
TestNG - 6.1.1
Exception:
Cannot instantiate abstract class or interface: com.test.Example; nested exception is org.hibernate.InstantiationException
JPA Entities:
@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 {}
Repository:
public interface ExampleRepository extends JpaRepository<Example, Long> {}
TestNG Class:
public class ExampleTest extends AbstractTransactionalTestNGSpringContextTests{
@Autowired
private ExampleRepository exampleRepository;
}
ExempleARepositoryandExempleBRepository