I have the following classes:
@Entity
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name="vehicletype", discriminatorType = DiscriminatorType.STRING)
public abstract class AbstractVehicle {
...
@Entity
@DiscriminatorValue(value = VehicleTypes.Values.Car)
public class Car extends AbstractVehicle {
...
@NoRepositoryBean
public interface AbstractVehicleRepository<T extends AbstractVehicle> extends PagingAndSortingRepository<T, Long> {
...
@RepositoryRestResource(collectionResourceRel="cars", path="cars")
public interface CarRepository extends AbstractVehicleRepository<Car> {
...
(discriminator values are constants within enums as described here)
Running against a MySQL database.
I can start my Spring Boot application, but when I try to access the REST URL /cars
, I get an exception complaining that the abstract_vehicle
table doesn't exist.
I'm using Spring Boot 1.3.1 on a MySQL database, with the Spring Starts for Security, Web, Data-Rest, Hal-Browser and Data-Jpa in my dependencies.
Is SINGLE_TABLE
inheritance compatible with Spring Data Rest Repositories? What am I doing wrong?