Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does "io.quarkiverse.jpastreamer:quarkus-jpastreamer:1.0.1" contain everything or do i need to add the annotation processor separately? #295

Open
BenjaminJacober opened this issue Feb 16, 2023 · 6 comments
Assignees
Milestone

Comments

@BenjaminJacober
Copy link
Contributor

When using the quarkiverse dependency, do i still need to add the annotationProcessor line in gradle or not? JPAStreamer seems to work but it's terribly slow and according to https://speedment.github.io/jpa-streamer/jpa-streamer/1.1.2/predicates/predicates.html#_fields i should really use the classes with the $ name for it to be faster. The problem is, they're nonexistent after rebuilding, I can't find them in any build folder.

@julgus
Copy link
Member

julgus commented Feb 16, 2023

Yes, we strongly recommend using the generated fields, as JPAStreamer cannot optimize the pipeline when using regular lambdas.

I must admit I do not have much first hand experience with Gradle and Quarkus, but I would suggest trying to add the annotation processor line as described in:
https://speedment.github.io/jpa-streamer/jpa-streamer/1.1.2/get-jpa-streamer/install-gradle.html.

If that does not work, could you please share some more information about your project so I can try reproducing the issue?

@BenjaminJacober
Copy link
Contributor Author

So after a lot of trying i found out that IntelliJ doesn't display the $ classes even though some of them are there. They end up in the /out folder for me. (This is without the annotationProcessor so I am assuming the quarkus jpaStreamer is sufficient.)
Here's the weird part though:

  1. I can only see them in a file explorer and not IntelliJ (same path)
  2. Only some Entity classes are converted, not all of them
  3. IntelliJ doesn't recognize the generated entities and marks them red in my code. I saw that you have a code snippet for that but it doesn't seem to work for me. https://speedment.github.io/jpa-streamer/jpa-streamer/1.1.2/get-jpa-streamer/install-gradle.html
  4. The name of the generated files are weird. For example Books gets turned into Books$1.class not Books$.class. Also there is a Books$Type file which i assume is generated because there is a Type enum in my Books ORM.
  5. I haven't changed any of the code for the BookRepository to use the jpaStreamer but I've changed my PageRepository to use jpaStreamer, yet there is no Page$ being generated.
  6. Some files without the @entity annotation but have an enum get turned into $ files.

@julgus
Copy link
Member

julgus commented Feb 17, 2023

Thank you for taking the time to detail your issue. How strange that IntelliJ will not display the $ classes. I just tried setting up a Gradle project myself and the generated entities are placed in build/classes/generated/sources/annotationProcessor.
I am specifying the annotationProcessor in the build-file however, have you tried if that makes a difference?

image

To try to sort this up, I have some follow-up questions:

  1. While strange, IntelliJ sometimes gets confused for different reasons. Have you tried invalidating the IntelliJ caches?
  2. Are all Entity classes placed in the same package? Is there any apparent difference between entities that do trigger the annotation processor and the ones that do not? Are you by any chance using Panache and the Active Record pattern?
  3. It may not recognize them if they are placed in a location that is not accepted as a source file, which could be the case if they are placed in /out.
  4. This sounds very strange, would you mind sharing one of the original files and the output so I can try and reproduce it? Specifically, your observation about Enums is interesting.
  5. Whether or not your Repositories use JPAStreamer should not impact if files are generated for that entity. $-classes should be generated for all classes annotated with @entity.
  6. Could you share an example and the matching generated class? I need to investigate this further.

@BenjaminJacober
Copy link
Contributor Author

BenjaminJacober commented Feb 17, 2023

Ah, sorry i should've mentioned that as well.
0. I just realised that the generated files are in fact not the ones from JPAStreamer. If i go onto our dev branch without the JPAStreamer stuff and do a fresh compile they are also there. Probably from a different dep (maybe Lombok).

  1. Yep, already did that.
  2. a. No, we even have separate projects with their own src and main folders. I put the dependency one level above all these projects because we want to use it everywhere. Maybe i should try to put it on a lower level?
    b. (see 0.) We don't use Panache.
  3. Hmm. What could be a reason for that? They're in src/main/.... (The /out folder only exists on the JPAStreamer branch, so I assume it's got something to do with that. It's completely empty besides an empty beans.xml file)
  4. I can't it's company code, (see 0.)
  5. Ok, thanks for clearing that up.
  6. (see 0.)

By the way what is the reason for the version difference between quarkus and the normal version? Does 1.1.2 normal = 1.0.1 quarkus?

@BenjaminJacober
Copy link
Contributor Author

Is there any way that i can check if the annotation processor is even working? The JPAStreamer itself i can see in the logs and also in my code as working but the field generator seems to be nonexistent.

@BenjaminJacober
Copy link
Contributor Author

BenjaminJacober commented Feb 20, 2023

Note: JPA Streamer Field Generator Processor
warning: Supported source version 'RELEASE_8' from annotation processor 'org.gra
dle.api.internal.tasks.compile.processing.TimeTrackingProcessor' less than -sour
ce '17'
1 warning

Task :xxx:compileJava FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':xxx:compileJava'.

java.lang.NoClassDefFoundError: javax/persistence/Entity

Does this help? I think I got a bit further

@julgus julgus self-assigned this Jul 10, 2023
@julgus julgus modified the milestones: 3.0.3, 3.0.4 Jul 10, 2023
@julgus julgus modified the milestones: 3.0.4, 3.0.5 Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants