I am working on publishing spring datastores via SDR. When I go to my rest URL ( http: // localhost: 8080 / trxes ), I get the error message: {"cause": null, "message": "PersistentEntity must not be null!" }
Upon closer inspection of the spring data source, I see that the getRepositoryFactoryInfoFor () method returns information about empty storage i.e.
private RepositoryFactoryInformation<Object, Serializable> getRepositoryFactoryInfoFor(Class<?> domainClass) { Assert.notNull(domainClass, "Domain class must not be null!"); RepositoryFactoryInformation<Object, Serializable> repositoryInfo = repositoryFactoryInfos.get(ClassUtils .getUserClass(domainClass)); return repositoryInfo == null ? EMPTY_REPOSITORY_FACTORY_INFO : repositoryInfo; }
The likely cause of my problem is that my persistent objects inherit from the same base class, and I use the same table strategy as follows:
the database has a TRX table with the corresponding Trx class. VariableIncome, VariableExpense, FixedIncome, and FixedExpense all inherit from Trx and are stored in the TRX table.
@Entity @Table(name = "TRX") @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name = "TRX_TYPE", discriminatorType = DiscriminatorType.STRING) abstract public class Trx extends AbstractPersistable<Long> {
All subclasses are similar to VariableIncome, shown below:
@Entity @DiscriminatorValue("VARIABLE_INCOME") public class VariableIncome extends Trx {
My repository setup (annotations of this class):
public interface TrxRepository extends CrudRepository<Trx, Long> {
I run the setup described using:
@SpringBootApplication public class RestApplication { public static void main(String[] args) { SpringApplication.run(RestApplication.class, args); } }
I suppose I'm looking for is there a way to tell the SDR (when it tries to determine what my constant classes are) that all subclasses should map back to Trx?