Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
APT NullPointer when generating query with JPA and Collections common base class #3
When using the APT-JPA generator in my setup, I get the following exception:
Another Exception is hidden in the example, which can be caused by annotating AValueObject with @QuerySupertype:
See attachment for the example eclipse project which reproduces the problem. Run the ant target "generate" to reproduce the issue.
This is a serious problem which hinders me from integrating querydsl into my platform. Thanks for your help!
Could you try upgrading to 2.2.0-beta4 and reproduce the problem? I could not yet reproduce the problem in a Querydsl test in SVN trunk.
I am using 2.2.0-beta4 in my platform, though provided the sample with a prior version. So the problem also occurs with 2.2.0-beta4. Is there a way to download the SVN snapshots via maven so I can test those?
I am currently on holidays, but Vesa might be able to look into this.
Ok, the integration of QueryDSL is on hold for me until this blocker is resolved.
In the meantime my data model got refactored and thus I don't have levels of @Embedded higher than 1 anymore. Thus I have integrated 2.2.0-beta4 into the platform. Anyway I am still interested in fixing this bug and am willing to test this with 2.2.0-beta5. Is there an estimate when that will be available?
2.2.0.beta5 is out now, I also made some improvements to the current SVN trunk. Could you test this with SVN trunk?
I couldn't yet reproduce the first issue in a Querydsl test, but I've been able to reproduce the second one.
Maybe it would be easiest to just avoid the mixed annotations. Just use the Querydsl annotations for types which are not covered by the JPA annotation processor.
Is there only one module in your real application or are the sources split?
Now I was able to reproduce always the first issue and got that fixed. I also just realized that my advice in the previous comment doesn't work.
I will try to find a fix for this.
I believe a valid fix for this scenario would be to use the following APT options in one of the processors :
Unfortunately it is really difficult to fix this otherwise since the APT throws an Exception already when requesting a file handle to a source file which has been created via another APT processor.
A Workaround might be, to run the APT processors in seperate tasks? Atleast this is what solved my problem when I was using the Hibernate Metamodel Generator APT Processor together with the querydsl APT processors. The Hibernate processor did not want to generate the Entity_ files for every entity there was. Seperating them resolved the issue. Currently I am running the querydsl processors seperately in my platform aswell. Maybe you can verify this in the testcase. I am currently unable to do that.
Yes, this works as well.
I've looked through the code and the NPE appears to be at line 479 in Processor.hasKnownAnnotation. Unless there's something mysterious going on, the configuration.getSupertypeSerializer() test should actually be configuration.getSupertypeAnnotation(). It looks like it's testing for null on a different annotation than the one it actually tries to go and get.
Fixed the NPE issue in SVN trunk. Could you verify that it works now?
Could you try again with the latest SNAPSHOT version from SVN trunk? I made some other improvements to APT processing.
Querydsl has now moved to GitHub : https://github.com/mysema/querydsl
Should be able to try again tomorrow.
On Wed, Aug 3, 2011 at 6:19 AM, Timo Westkämper
Have you been able to verify that this works now?
I have not yet; I am traveling in China, and my ability to do work varies quite a bit depending on where I am. I will try again shortly to see if it's fixed with the latest. Thanks for your attention on this matter.