Spring Boot with the usage of jpaStreamer $ issue - Cannot resolve symbol 'User$'

121 Views Asked by At

I tried to implement an example of Spring Boot with the usage of jpaStreamer. I use Intellij Idea to handle with it. I have a problem in jpaStreamer.stream.

Here are the dependencies shown below

<jpastream.version>1.1.4</jpastream.version>

<dependency>
    <groupId>com.speedment.jpastreamer</groupId>
    <artifactId>jpastreamer-core</artifactId>
    <version>${jpastream.version}</version>
</dependency>

<dependency>
    <groupId>com.speedment.jpastreamer.integration.spring</groupId>
    <artifactId>spring-boot-jpastreamer-autoconfigure</artifactId>
    <version>${jpastream.version}</version>
</dependency>

Here is the sample method of UserService shown below

public List<User> findAllForJpaStreamer() {
   return jpaStreamer.stream(User.class).
          sorted(User$.id).
          collect(Collectors.toList());
}

I get this error message shown below

Cannot resolve symbol 'User$'

Here is the screenshot shown below

enter image description here

enter image description here

How can I fix it?

Here is the repo : Link

2

There are 2 best solutions below

0
S.N On BEST ANSWER

I fixed the issue. It caused by the version of jpastream.version. After I defined it as 3.0.3 in pom.xml, the problem disappeared.

<jpastream.version>3.0.3</jpastream.version>
3
NoDataFound On

Reading their documentation, and the gradle integration, I think you are simply lacking the annotation processor:

dependencies {
    compile "com.speedment.jpastreamer:jpastreamer-core:version"
    annotationProcessor "com.speedment.jpastreamer:fieldgenerator-standard:version"
}

To fix your problem, you probably just need to add an annotation processor: https://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html

<plugin>
  <artifactId>maven-compiler-plugin</artifactId>
  <configuration>
    <annotationProcessorPaths>
      <path>
        <groupId>com.speedment.jpastreamer</groupId>
        <artifactId>fieldgenerator-standard</artifactId>
        <version>${jpastream.version}</version>
      </path>
    </annotationProcessorPaths>
  </configuration>
</plugin>

You may also, if it works, create a pull request to fix the README.