1

I am getting below error when I use (https://github.com/pramoth/specification-with-projection)

Caused By: org.springframework.data.mapping.PropertyReferenceException: No property findOne found for type <Entity class>

any idea why its throwing this exception?

Javee
  • 71
  • 1
  • 1
  • 8

1 Answers1

0

Looks like you are using incorrect Spring Data version.

This library works with the old versions only. The last changes to support new Spring Data were merged, but not still published.

You can try to use the last version from here https://mvnrepository.com/artifact/th.co.geniustree.springdata.jpa/specification-with-projections

Maybe it will work.

Also I have a fork of the library that supports the last Spring Boot versions and Java 17. It can be temporarily used before the last version of the library will be published

https://github.com/v-ladynev/specification-with-projection-embeded

v.ladynev
  • 19,275
  • 8
  • 46
  • 67
  • Thanks for the quick response. I am using spring boot 2.7.2, specification-with-projection version 2.0.2 and jdk 1.8. I am not sure why its looking for findone property in entity class? Note: I have not added enablerepositories to include the JpaSpecificationExecutorWithProjectionImpl since I have multiple DB config where I have individual file and enablerepositories to scan the package. – Javee Nov 18 '22 at 11:54
  • @Javee You have to add `JpaSpecificationExecutorWithProjectionImpl.class` with `@EnableJpaRepositories`. `findOne()` is a method of the custom repository that is why. I don't think that `specification-with-projection 2.0.2` supports `Spring Boot 2.7.2`. – v.ladynev Nov 18 '22 at 13:34
  • Could you please tell me what springboot and specification with projection versions are you using ? – Javee Nov 18 '22 at 14:08
  • @Javee Spring Boot 2.7.2 I don't use `specification-with-projection`. It is impossible until a new version will be released. I use https://github.com/v-ladynev/specification-with-projection-embeded – v.ladynev Nov 18 '22 at 14:25
  • Thank you! It’s working now with the manually copied code. I am trying to access one column (basically sum of quantity from child collections). How to define the projection for that? Any suggestions? – Javee Nov 19 '22 at 16:23
  • @Javee Sure. Better to ask a separate question for that, with all details. – v.ladynev Nov 20 '22 at 16:18