Compiling JPA metamodel generated by Annotation Processor [message #532974] |
Tue, 11 May 2010 14:04  |
Eclipse User |
|
|
|
I might be missing something obvious, but I've been googling for hours on this and found no answers...
I have enabled annotation processing in a java project, then added on the factory settings the eclipselink-jpa-modelgen_2.0.2-XXXX.jar. As I have GlassFish V3 as library, the needed classes for the processing itself are already on classpath.
The JPA 2 metamodel classes are correctly generated, but they are not compiled. So, I can use them (autocomplete works, etc), but always have compile errors stating that those classes couldn't be found.
In fact, they are not compiled into my output folder, despite being in the source path.
What am I doing wrong?
|
|
|
|
|
|
Re: Compiling JPA metamodel generated by Annotation Processor [message #533747 is a reply to message #533237] |
Sun, 16 May 2010 12:07   |
Eclipse User |
|
|
|
"Luis Fernando Planella Gonzalez" <lfpg.dev@gmail.com> wrote in message
news:hsekbo$7n6$1@build.eclipse.org...
> The problem was not that the annotation processor weren't being invoked -
> it was (all classpath was ok) and metamodel classes were generated. The
> problem was that those generated java files were not being compiled
> themselves into the output folder. The batch mode did the trick.
If there is a way that you can make a sample project that demonstrates the
problem, please file a bug (http://bugs.eclipse.org/bugs) and attach an
archive of the project.
It might be that the processor is using java.io.File, rather than the Filer
API (which is part of the annotation processing API), to generate the files.
That's the only reason I can think of why running in batch mode would make a
difference, and actually I'm a bit surprised that even batch mode would help
in that case.
Batch mode is mainly intended to support processors that can't handle
incremental processing: for example, that rely on static variables being
properly initialized at the beginning of the run, or that rely on being able
to process all the files in a single round rather than one at a time, or
that make assumptions about how many rounds of processing will occur before
they exit. Sun's JPA processors do, I think, need to be run in batch mode;
but the symptoms you're describing are puzzling to me.
Thanks!
|
|
|
Re: Compiling JPA metamodel generated by Annotation Processor [message #533752 is a reply to message #533747] |
Sun, 16 May 2010 13:39  |
Eclipse User |
|
|
|
Sorry, but we've given up on using JPA metamodel, as JPA's criteria queries are way too complex.
We've switched to Querydsl instead.
But it shouldn't be hard to reproduce: I just had a project with JPA entities, and added on the annotation processor classpath the eclipselink jars as previously described....
I've also tried using the hibernate's metamodel generator, and had the same effect (had to enable batch mode, or generated classes weren't compiled.
|
|
|
Powered by
FUDForum. Page generated in 0.03442 seconds