0
interface PersonRepository extends CrudRepository<Person, Long> {
}

//this is of course invalid
List<Map<String, String>> persons = repository.findAll(Pageable p, Sortable s);

I want to benefit from the CurdRepository methods that make use of eg Pageable, Sortable or Predicate. Though I'd like not to define my full @Entity object beforehand to fetch all desired columns, but my goal is just to fetch any columns present in that table of persons.

So to say: a generic SELECT using the jpa entity.

Is that possible?

membersound
  • 81,582
  • 193
  • 585
  • 1,120
  • So you basically want a `Select * from Person` without defining a `Person` class with the proper mapping to all columns? – XtremeBaumer May 29 '19 at 08:50
  • Shortly, ```On the other hand, if you do use table inheritance, then you can use the abstract type.``` See [Use abstract super class as parameter to Spring data repository](https://stackoverflow.com/q/25237664/10345277/) – 윤현구 May 29 '19 at 09:04
  • 2
    You want to use JPA but not define Entities? So why don't you use SQL? – Simon Martinelli May 29 '19 at 14:05

0 Answers0