Home » Eclipse Projects » EclipseLink » Create Canonical Metamodel without using any JPA/EclipseLink Annotations
Create Canonical Metamodel without using any JPA/EclipseLink Annotations [message #673419] |
Mon, 23 May 2011 15:15 |
mgira Messages: 6 Registered: May 2011 |
Junior Member |
|
|
Hi all,
i was looking for a way to create a JPA 2 Canonical Metamodel from my entites with EclipseLink.
Since i'm not using any JPA/EclipseLink Annotations at all but only orm.xml and eclipselink-orm.xml, the CanonicalModelProcessor doesn't even get to start, or maybe it's me doing something wrong.
Is there a way to create a Canonical Metamodel from my Entity Mappings without having to use Annotations?
If so, what am i missing?
I'm using Maven btw.
Thanks in advance
[Updated on: Mon, 23 May 2011 15:18] Report message to a moderator
|
|
| |
Re: Create Canonical Metamodel without using any JPA/EclipseLink Annotations [message #673946 is a reply to message #673740] |
Wed, 25 May 2011 08:56 |
mgira Messages: 6 Registered: May 2011 |
Junior Member |
|
|
Hi James, thanks for your reply.
James wrote on Tue, 24 May 2011 11:27The metamodel generator should work with XML or annotations.
After a bit of research, i think that it will not work unless i use JPA Annotations, so, if there is not one single JPA Annotation used, the CanonicalModelProcessor will not be triggered at all.
You are probably referering to the documentation, i've read it up&down,IMHO they missed out to put in a small bit of important information: No Annotations, no canonical metamodel
Quote:What error do you get?
No error, but no "action" either.
James wrote on Tue, 24 May 2011 11:27
How are you executing the generator, is your orm.xml file listed in your persistence.xml and on the classpath?
I'm using the Maven Plugin maven-processor-plugin from org.bsc.maven.
The log shows that the Processor is not invoked at all (since it relies on Annotations):
[INFO] Adding compiler arg: -Aeclipselink.persistencexml=src/main/resources/META-INF/persistence.xml
[INFO] javac option: -cp
[INFO] javac option: C:\sources\workspace_3.6.1_JEE\myproject-parent\myproject-domain\src\main\resources;C:\sources\workspace_3.6.1_JEE\myproject-parent\myproject-domain\target\classes;C:\Users\USERNAME\.m2\repository\org\slf4j\slf4j-api\1.5.8\slf4j-api-1.5.8.jar;C:\Users\USERNAME\.m2\repository\org\slf4j\slf4j-log4j12\1.5.8\slf4j-log4j12-1.5.8.jar;C:\Users\USERNAME\.m2\repository\log4j\log4j\1.2.14\log4j-1.2.14.jar;C:\Users\USERNAME\.m2\repository\com\google\inject\guice\3.0\guice-3.0.jar;C:\Users\USERNAME\.m2\repository\javax\inject\javax.inject\1\javax.inject-1.jar;C:\Users\USERNAME\.m2\repository\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;C:\Users\USERNAME\.m2\repository\com\google\inject\extensions\guice-persist\3.0\guice-persist-3.0.jar;C:\Users\USERNAME\.m2\repository\org\eclipse\persistence\javax.persistence\2.0.3\javax.persistence-2.0.3.jar;C:\Users\USERNAME\.m2\repository\org\eclipse\persistence\eclipselink\2.2.0\eclipselink-2.2.0.jar
[INFO] javac option: -proc:only
[INFO] javac option: -Aeclipselink.persistencexml=src/main/resources/META-INF/persistence.xml
[INFO] javac option: -processor
[INFO] javac option: org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor
[INFO] javac option: -d
[INFO] javac option: C:\sources\workspace_3.6.1_JEE\myproject-parent\myproject-domain\target\classes
[INFO] javac option: -s
[INFO] javac option: C:\sources\workspace_3.6.1_JEE\myproject-parent\myproject-domain\target\generated-sources\apt
[INFO] diagnostic warning: The following options were not recognized by any processor: '[eclipselink.persistencexml]'
If i start using JPA Annotations (like @Entity, @Embeddable), the Processor gets triggered and does create a canonical metamodel, and apperantly it does take the orm.xml into account also.
However, i have to avoid annotations in this project (proof of concept, that is also supposed to show differences between JPA and JDO), so this is not an option, or at least to me, the cannonical metamodel is not worth putting in JPA annotations.
org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor extends
javax.annotation.processing.AbstractProcessor, so far it looks to me, the only way to use it, is using annotations.
Btw., Hibernate, OpenJPA and DataNuclues for JPA also use an Annotation Processor for creating the canonical metamodel, the JPA 2 spec. does not specifiy that the JPA implementor needs to supply a tool for creating the metamodel at all.
What puzzles me is that i was told that projects like Teneo and others do create a canonical metamodel, without the use of annotations, well thats what i was told.
If i'am wrong with any of my findings/statements please correct me, since currently i have to assume that i can not generate a metamodel without using annotations.
[Updated on: Wed, 25 May 2011 08:57] Report message to a moderator
|
|
| | |
Re: Create Canonical Metamodel without using any JPA/EclipseLink Annotations [message #675179 is a reply to message #673419] |
Mon, 30 May 2011 14:08 |
|
The problem is that the APT compiler hook that allows the metamodel to be generated is based on annotations processing. So if you do not have any JPA annotations in any of the classes being compiled, then the compiler will not call on the metamodel generator.
So, you need at least one class that has a JPA annotation.
Please log a bug to track this issue. We should be able to have things generated even without usage of a JPA annotation, although, I'm not sure it is possible without any annotation, more investigation is needed.
James : Wiki : Book : Blog : Twitter
|
|
| |
Goto Forum:
Current Time: Tue Sep 24 05:36:06 GMT 2024
Powered by FUDForum. Page generated in 0.02763 seconds
|