This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
BACKGROUND: Metamodel classes generated for their corresponding managed entities allow construction of object based queries. For example for following JPA entity: @Entity public class Order { @Id Integer id; @ManyToOne Customer customer; @OneToMany Set<Item> items; BigDecimal totalCost; } generated metamodel class looks like: @StaticMetamodel(Order.class) public class Order_ { public static volatile SingularAttribute<Order, Integer> id; public static volatile SingularAttribute<Order, Customer> customer; public static volatile SetAttribute<Order, Item> items; public static volatile SingularAttribute<Order, BigDecimal> totalCost; } and using such class allows for queries of the form: CriteriaBuilder cb = ordersEntityManager.getCriteriaBuilder(); CriteriaQuery<Order> cq = cb.createQuery(Order.class); SetJoin<Order, Item> itemNode = cq.from(Order.class).join(Order_.orderItems); cq.where( cb.equal(itemNode.get(Item_.id), 5 ) ).distinct(true); PROBLEM: IDE does not generate metamodel classes automatically.
Created attachment 92073 [details] patch for build.xml This patch can be applied to build.xml in Web project
SHORT TERM WORKAROUND: The attached patch is fine tuned for Web project's build.xml. For J2SE project the patch would b every similar. It changes two things: * defines xmlns:webproject2 namespace (which would be different for J2SE project) * adds "-pre-compile" target which generates metamodel classes using EclipseLink's Canonical Model Generator (ELUG) One more steps which has to be done in Web project is to add EclipseLink(JPA2.0) library to project classpath (use Project Properties | Libraries | Add Library)(and if your server already contains EclipseLink then untick "package" checkbox). This library is needed only for compile time and is not required in runtime - annotation processor which generated metamodel classes is used from EclipseLink implementation of JPA2 (class org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor). Following this workaround building of project will generate metamodel classes which will be shown in project's logical view under "Generated Sources (jpa-metamodel)" node and can be used from regular project's sources, in code completion, etc.
what is the best way for generation? 1. keep metamodel in sync with current entities, I don't know about api yet but it may be tricky to update only specific entities instead of all and may cause problems with performance. 2. generate on demand with some menu action. 3. another way.
I am assuming this should be a build step executed as a part of the build. Is that right David? One question is what happens with Compile on Save.
yes it can be build step and may be should be build step, but user will not be able to reference this classes in code before build then, may be it's ok.
At the moment I think that implementation should follow precedence set by Web Services stub generation: it is a build step which produces generated java files to build/generated subfolder (which makes them consequently visible in project's logical view and available in code completion). I tend to think it is acceptable that project has to be build first before classes can be referenced. And if not we can try to improve it later. Other things to evaluate/resolve are: * will be the metamodel generation hardcoded in project type's build scripts or should Persistence module use AntExtender API and be able to plug metamodel generation into any Ant based project type? * what needs to be done for Maven? * should it be configurable to switch metamodel generation on and off in project's UI? If yes where the UI should be so that it is discoverable. * maybe other issues
re maven: I haven't really investigated the details but in general we should look for a plugin that generates the file(s). And then add the relevant plugin configuration snippet into the pom.xml file. from david's patch it looks like additional config for maven-compiler-plugin could be enough, BUT from nbm maven project experience it seems there are some issues with the compiler plugin and annotations.. so it just has to be tested.. http://maven.apache.org/plugins/maven-compiler-plugin/examples/pass-compiler-arguments.html
What about refactorings? If you want to rename a property, not only the meta model sources (generated) have to change, but all references, too! This could be tricky...
Re. refactoring - good point, refactorings will have to be evaluated. Some of the cases should be easy to handle, for example if user renames Order.items to Order.orderItems then it is easy to apply the same change to generated Order_ class.
Is there any refactoring in Web Services stub generation case?
I found no refactoring, but I also can't update at all, may be I miss something, for me it seems tricky to support refactoring if online metamodel classes update will not be done (if classes will be [re]generated with build action only).
In latest build I was able to add org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor as annotation processor in j2se project properties, but it was required to copy persistence.xml to {proj}/classes/META-INF manually. Metamodel classed was generated with build action.
issue related to persistence.xml https://bugs.eclipse.org/bugs/show_bug.cgi?id=302450
One of possible solution will be to add checkbox to some wizards, like new PU, or new entities etc, with option "add annotation processor", this will add annotation processor to standard project properties and we will not need special properties for "matamodel generation". The only question if we need also separate wizard to add metamodel generation, it may depends on resolution of a problem with persistence.xml if it will require just to add org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor in properties it may not require separate wizard but if some more properties will be required to handle persistence.xml location wizard is good in this case.
My last comment is about j2se project, what is missed from realization, others projects should be done the same way, depending of final decision for j2se.
Could we just add the annotation processor every time we are creating persistence.xml with EclipseLink 2.0 as the persistence provider, without asking the user? Or is that not desirable for some reason?
It's one of solutions. Need to think more if it's not desirable in some cases, may be because annotation processor will require eclipselink library addition in case of web/ejb modules.
Yeah, for now I would always automatically add annotation processor whenever JPA implementation library provides one. If later it is a problem (slight impact on build performance maybe?) we can find a way to let users disable it. I expect that most of the times you will simply need it. When designing the solution Sergey, keep in mind that different JPA impls will most likely have different annotation processor class.
it's not hard as it can be added as new provider property, most will be null except one for eclipselink v2.0.
Integrated into 'main-golden', will be available in build *201002180200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/38fb04e38151 User: Sergey B. Petrov <sj-nb@netbeans.org> Log: #178108 - now if persistence.xml is created and canonical processor is found it will be added to processors list in j2se, it's not final realization yet, also do not handle persistence.xml location problem
tried to use eclipselink.persistencexml to handle a problem with persistence.xml, but it looks thi property do not work with ../something type of paths and also do not work with full path /something.
Integrated into 'main-golden', will be available in build *201002190200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/29b39bd096d1 User: Sergey B. Petrov <sj-nb@netbeans.org> Log: #178108 - minotr modification, move to request processor
there will be separate classpath for annotation processors after fix of issue #180935. in case if library isn't required for compile and currently isn't added (as for web project on gf3) it need to be added to processors libraries only.
Integrated into 'main-golden', will be available in build *201002220200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/8ff017d44819 User: Sergey B. Petrov <sj-nb@netbeans.org> Log: #178108 - move to mutex, update ClassPath
Integrated into 'main-golden', will be available in build *201002270200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/ecd0b0a80b14 User: Sergey B. Petrov <sj-nb@netbeans.org> Log: #178108 - for web project
Integrated into 'main-golden', will be available in build *201003030200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/74949e16722d User: Sergey B. Petrov <sj-nb@netbeans.org> Log: #178108 - all options are saved now, also if create pu for web project annotation processor will work now
For Maven, the workaround that worked for me (starting with a Web project that already uses persistence, has persistence.xml, has the EclipseLink dependencies etc) is the following: 1. Add a <pluginRepositories> section before the <repositories> section as follows: <pluginRepositories> <pluginRepository> <id>maven-annotation-plugin</id> <url>http://maven-annotation-plugin.googlecode.com/svn/trunk/mavenrepo</url> </pluginRepository> </pluginRepositories> 2. Add the following plugin under build/plugins <plugin> <groupId>org.bsc.maven</groupId> <artifactId>maven-processor-plugin</artifactId> <dependencies> <dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>javax.persistence</artifactId> <version>2.0.0</version> </dependency> <dependency> <groupId>org.eclipse.persistence</groupId> <artifactId>eclipselink</artifactId> <version>2.0.0</version> </dependency> </dependencies> <executions> <execution> <id>process</id> <goals> <goal>process</goal> </goals> <phase>generate-sources</phase> <configuration> <outputDirectory>${project.build.directory}/generated-sources/apt</outputDirectory> <compilerArguments>-Aeclipselink.persistencexml=src/main/resources/META-INF/persistence.xml</compilerArguments> <processors> <processor>org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor</processor> </processors> </configuration> </execution> </executions> </plugin> 3. Move the dependency on javax.persistence to the first place so it is before the dependency on javaee-web-api. This is because the JPA API classes that are included in javaee-web-api are stub classes without implementations, so they need to be overriden by the API classes in the javax.persistence artifact. After that, the metamodel classes will be generated. Discovered thanks to this blog: http://blog.gueck.com/2009/12/generating-jpa-20-criteria-canonical.html Milos, what do you think about this approach?
1. the processor thing is probably correct. Is it in 1.6 only or is 1.5 also supported? once the current trunk of maven-compiler-plugin gets released, we could simplify the setup by depending on compiler plugin on with 1.6 2. the dependency on the googlecode plugin repository is sort of dangerous. 3. the publishing of signatures in javaee-api artifacts is a major disaster. I think we've expressed that concern at that time, didn't we? the tricks with dependency ordering could be fragile in large scale projects. the fact that it made it's way into central is also sobering.. I was not very happy with one single api jar either..
Integrated into 'main-golden', will be available in build *201003040200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/f13b50674483 User: Sergey B. Petrov <sj-nb@netbeans.org> Log: #178108 add proper library in case "create pu from non new pu wizards"
> Is it in 1.6 only or is 1.5 also supported? I think we can just limit it to 1.6 and ignore 1.5. Java EE 6 requires JDK 6 anyway, and for the other use cases (Java EE 5 or Java SE), JDK 6 is widely available and should be usable. We should encourage users to always use JDK 6 with JPA 2 - I just filed a related bug 181531. > once the current trunk of maven-compiler-plugin gets released, we could > simplify the setup by depending on compiler plugin on with 1.6 Good, any idea when that could be? > the dependency on the googlecode plugin repository is sort of dangerous. Are there any alternatives? > the publishing of signatures in javaee-api artifacts is a major disaster. I agree.
(In reply to comment #30) > > once the current trunk of maven-compiler-plugin gets released, we could > > simplify the setup by depending on compiler plugin on with 1.6 > > Good, any idea when that could be? it's needed for the nb platform annotations as well, so I'd like to have it for the 6.9 release out, but it's an external dependency on the maven folks, I need to convince someone to do the release. > > > the dependency on the googlecode plugin repository is sort of dangerous. > > Are there any alternatives? AFAIK not any better ones.. > > > the publishing of signatures in javaee-api artifacts is a major disaster. > > I agree.
Integrated into 'main-golden', will be available in build *201003050200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/946b5856b925 User: Sergey B. Petrov <sj-nb@netbeans.org> Log: #178108 add proper library in case "create pu from non new pu wizards" for missed in previous commit wizards
Integrated into 'main-golden', will be available in build *201003081350* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/c31180397425 User: Sergey B. Petrov <sj-nb@netbeans.org> Log: #178108 added to handle cutom indexer
metamodel generation works with bundled eclipselink in j2se/web/ejb/app clien projects now, but j2se and we have extra features and we may need to discuss if the same should be done in ejb/app client ot it should be removed from j2se/web. j2se and web add canonical processor to processors list in project's properties when ejb/app client do not.
I created a new bug 181861 for the Maven-specific part. Let's continue to discuss the Maven aspect in this bug report.
Integrated into 'main-golden', will be available in build *201003120200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/c3d35d3bf57a User: Sergey B. Petrov <sj-nb@netbeans.org> Log: #178108 return position to avoid exception from metamodel processor (seems related to pasing not yet copied file), add position for all members in Editor/text/x-java to avoid validation tests failure
now all 4 projects should behave the same way, if user use ap list in project properties already, ap will be added to the list, and will not be added if list is empty. as it's umbrella now, does it mean it should be closed only after all related issues are fixed?
Thanks a lot, Sergey! I think we can close this issue now.
fixed
reopen after fix #183473 but -> as it should be easy to add ap processor in project properties now.
Anyway, until the EL issue is fixed, I think the right approach should be to enable this for Ant build, but disable in the editor.
It will generate metamodel but it will not be possible to use it in netbeans because of compile on save/deploy on save problems.
A QUICK QUESTION. what changes do i have to do to to the patch for it to work in a console application enviroment? Thanks in advance.
if you'll add eclipselink-jpa-modelgen_2.0.1.v20100213-r6600.jar from eclipselink distribution to classpath, metamodel will be generated.
thank you for your quick response, when i built i get the following error "Caused by: java.lang.RuntimeException: Unable to load persistence.xml : C:\Websites\DATAImporter\build\classes\META-INF\persistence.xml (The system cannot find the path specified)" when i add "\classes\META-INF\persistence.xml" it creates the metamodels in the classes directory but i can not still reference them. when i clean and built it all gone including "\classes\META-INF\persistence.xml" am i missing something here? thanks again (In reply to comment #44) > if you'll add eclipselink-jpa-modelgen_2.0.1.v20100213-r6600.jar from > eclipselink distribution to classpath, metamodel will be generated.
I'm not sure what console application do you use, is it j2se application created in netbeans? what build do you use?
Hi, thanks for your response. yes i am using java se console application generated from netbeans 6.8. And i am building using the default build command that comes with netbeans. I assume netbeans is using the ant command to build. i am pasting the error log from netbeans after build command. init: deps-clean: Updating property file: C:\Websites\DataImporter\build\built-clean.properties Deleting directory C:\Websites\DataImporter\build clean: init: deps-jar: Created dir: C:\Websites\DataImporter\build Updating property file: C:\Websites\DataImporter\build\built-jar.properties Created dir: C:\Websites\DataImporter\build\classes Created dir: C:\Websites\DataImporter\build\empty Compiling 37 source files to C:\Websites\DataImporter\build\classes Note: Creating the metadata factory ... Note: Building metadata class for round element: EntitieControllers.DetailsJpaController ............. Note: Building metadata class for round element: entities.Users error: java.lang.RuntimeException: Unable to load persistence.xml : C:\Websites\DataImporter\build\classes\META-INF\persistence.xml (The system cannot find the path specified) Note: org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnitReader.getInputStream(PersistenceUnitReader.java:105) Note: org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnitReader.initPersistenceUnits(PersistenceUnitReader.java:160) Note: org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnitReader.<init>(PersistenceUnitReader.java:63) Note: org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:328) Note: com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:624) Note: com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:553) Note: com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:698) Note: com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:981) Note: com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727) Note: com.sun.tools.javac.main.Main.compile(Main.java:353) Note: com.sun.tools.javac.main.Main.compile(Main.java:279) Note: com.sun.tools.javac.main.Main.compile(Main.java:270) Note: com.sun.tools.javac.Main.compile(Main.java:69) Note: sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) Note: sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) Note: sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) Note: java.lang.reflect.Method.invoke(Method.java:597) Note: org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:56) Note: org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1065) Note: org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:882) Note: org.netbeans.modules.java.source.ant.JavacTask.execute(JavacTask.java:120) Note: org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) Note: sun.reflect.GeneratedMethodAccessor472.invoke(Unknown Source) Note: sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) Note: java.lang.reflect.Method.invoke(Method.java:597) Note: org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) Note: org.apache.tools.ant.Task.perform(Task.java:348) Note: org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62) Note: org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) Note: sun.reflect.GeneratedMethodAccessor472.invoke(Unknown Source) Note: sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) Note: java.lang.reflect.Method.invoke(Method.java:597) Note: org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) Note: org.apache.tools.ant.Task.perform(Task.java:348) Note: org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:394) Note: org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) Note: sun.reflect.GeneratedMethodAccessor472.invoke(Unknown Source) Note: sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) Note: java.lang.reflect.Method.invoke(Method.java:597) Note: org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) Note: org.apache.tools.ant.Task.perform(Task.java:348) Note: org.apache.tools.ant.Target.execute(Target.java:357) Note: org.apache.tools.ant.Target.performTasks(Target.java:385) Note: org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337) Note: org.apache.tools.ant.Project.executeTarget(Project.java:1306) Note: org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) Note: org.apache.tools.ant.Project.executeTargets(Project.java:1189) Note: org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:278) Note: org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:498) Note: org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151) An annotation processor threw an uncaught exception. Consult the following stack trace for details. java.lang.RuntimeException: java.lang.RuntimeException: Unable to load persistence.xml : C:\Websites\DataImporter\build\classes\META-INF\persistence.xml (The system cannot find the path specified) at org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:365) at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:624) at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:553) at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:698) at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:981) at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727) at com.sun.tools.javac.main.Main.compile(Main.java:353) at com.sun.tools.javac.main.Main.compile(Main.java:279) at com.sun.tools.javac.main.Main.compile(Main.java:270) at com.sun.tools.javac.Main.compile(Main.java:69) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:56) at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1065) at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:882) at org.netbeans.modules.java.source.ant.JavacTask.execute(JavacTask.java:120) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at sun.reflect.GeneratedMethodAccessor472.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:62) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at sun.reflect.GeneratedMethodAccessor472.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:394) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) at sun.reflect.GeneratedMethodAccessor472.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.performTasks(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337) at org.apache.tools.ant.Project.executeTarget(Project.java:1306) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) at org.apache.tools.ant.Project.executeTargets(Project.java:1189) at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:278) at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:498) at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151) Caused by: java.lang.RuntimeException: Unable to load persistence.xml : C:\Websites\DataImporter\build\classes\META-INF\persistence.xml (The system cannot find the path specified) at org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnitReader.getInputStream(PersistenceUnitReader.java:105) at org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnitReader.initPersistenceUnits(PersistenceUnitReader.java:160) at org.eclipse.persistence.internal.jpa.modelgen.objects.PersistenceUnitReader.<init>(PersistenceUnitReader.java:63) at org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:328) ... 46 more C:\Websites\DataImporter\nbproject\build-impl.xml:413: The following error occurred while executing this line: C:\Websites\DataImporter\nbproject\build-impl.xml:199: Compile failed; see the compiler error output for details. BUILD FAILED (total time: 0 seconds) (In reply to comment #46) > I'm not sure what console application do you use, is it j2se application > created in netbeans? > what build do you use?
One more thing. if i add the patch it doesnt built at all. thanks in advance
For 6.8 more changes may be required, all I said before is 6.9 dev/beta related. Some properties/paths may be missed.
ok thanks, so i will have to download and install beta then. thank you very much. (In reply to comment #49) > For 6.8 more changes may be required, all I said before is 6.9 dev/beta > related. > Some properties/paths may be missed.
I managed to install netbeans 6.9 beta. I imported a web application and a console application i been working on. I also added eclipselink-jpa-modelgen_2.0.1.v20100213-r6600.jar in the classpath. Now i have 2 issues. 1) the web application generates the metamodels same as this patch_for_build.xml, but it still does not build. it seems that it can not find the metamodels(where i import them it sais "can not find symbol"). this is an application which i been working on using the above patch and it worked very good using netbeans 6.8. 2)using the console application, i have the same issue, but the metamodels are not visible in the project tab. i can only find them in files tab. i also had a serious issue with glassfish on netbeans 6.8(could not start it), it seems fixed on this new beta version :) thanks in advance. (In reply to comment #49) > For 6.8 more changes may be required, all I said before is 6.9 dev/beta > related. > Some properties/paths may be missed.
sorry what i was ment to say, my web application builds but i can not deploy. cause of metamodels not found.
yes, it's an issue considered as a feature, but may be there is an issue with update of old projects, jpa2.0/annotation processor suppose source level is jdk6, update your project properties to jdk6. Also see compile section if both checkboxes related to ap ae selected.
Thank you, that was the main issue with the console application, i was using jdk5. my web app was already using jdk6. now for my final issue. the entity metamodels after a "clean and build" are created in a folder called "Generated Sources (ap-source-output)". when i try to deploy my project(I am refering to my web application, i get a similar issue in my console app, which in this case it does not run) I get the these messages. "Caused by: java.lang.RuntimeException: Uncompilable source code - cannot find symbol symbol: class Customer_ location: package Entities" i get the same error where for all the instances where i import my metamodel (etc: import Entities.Customer_;)classes. it seems my app can not read from the "generated sources(ap-source-output)/Entities" folder. is this an issue within netbeans 6.9 or am i missing another configuration somewhere. in netbeans 6.8 i didnt have this issue, after the metamodel generation it was building and deployed fine. is this feature going to be implemented in the final release on netbeans 6.9 in june? thanks in advance mike (In reply to comment #53) > yes, it's an issue considered as a feature, but may be there is an issue with > update of old projects, > jpa2.0/annotation processor suppose source level is jdk6, update your project > properties to jdk6. > Also see compile section if both checkboxes related to ap ae selected.
do you have "support ap ineditor" checkbox selected? if yes, can you attach sample project[s]?
thanks for your response where can i find this "support ap in editor" checkbox? thanks (In reply to comment #55) > do you have "support ap ineditor" checkbox selected? > if yes, can you attach sample project[s]?
sorry i just realised what u ment. you were referring to "enable annotation processing in editor". yes its ticked. when i get the chance i will sent you sample application. i was reading the following bug https://netbeans.org/bugzilla/show_bug.cgi?id=183779 and i realised i get a very similar warning too. "Note: Building metadata class for round element: jdbc.DataAccessor Note: File was not found: META-INF/orm.xml Note: File was not found: META-INF/eclipselink-orm.xml" i will send you the sample app sometime tomorrow (In reply to comment #56) > thanks for your response > > where can i find this "support ap in editor" checkbox? > > thanks > > (In reply to comment #55) > > do you have "support ap ineditor" checkbox selected? > > if yes, can you attach sample project[s]?
It will be good if you will attach to the issue, but if you can't share you can sent by e-mail. >is this feature going to be implemented in the final release on netbeans 6.9 in june? it's expected to work in beta but looks like there is an issue, should be fixed in release.
Created attachment 98000 [details] faulty application created with netbeans 6.9 using eclipselink JPA
i created another web application using 6.9, this app has only one entity. also you can find the sql to create this entity. thanks (In reply to comment #59) > Created an attachment (id=98000) [details] > faulty application created with netbeans 6.9 using eclipselink JPA
thanks, easily reproducible, looks like a regression in beta
ok, with attached sample project there are two problems - networkID do not exist, but after change to pageID I can buyild the project - ap in editor do not work even it's selected and it can be workarounded by switch off "Deploy on save" in projects's properties, and also need to be investigated/fixed in nb.
sorry about the networkID its not supposed to be there, it was a bad copy and paste. "Deploy and save" did the work. it can be deployed now. :) i assume i can continue working on my project now using 6.9. will you be able to let me know throught this post when its fixed so i can download the latest build? Thanks for your help. (In reply to comment #62) > ok, with attached sample project there are two problems > - networkID do not exist, but after change to pageID I can buyild the project > - ap in editor do not work even it's selected and it can be workarounded by > switch off "Deploy on save" in projects's properties, and also need to be > investigated/fixed in nb.
yes, the issue will be updated. you can also add eclipselink with model jar to Processor libraries instead of Compile
thanks i will give it a try (In reply to comment #64) > yes, the issue will be updated. > > you can also add eclipselink with model jar to Processor libraries instead of > Compile
Fixed deleted persistence.xml in allFilesIndexing. jet-main ab974a41cfd7
Thanks for the update. how do i get the updated version of netbean? download the latest development build? (In reply to comment #66) > Fixed deleted persistence.xml in allFilesIndexing. > jet-main ab974a41cfd7
It's not so easy, first it will take some time to propagate the patch from jet-main repository to golden-main from which the night builds are done (mostly it takes a day). Then it will be available in the dev (night) build.
thanks for your respose, so i have to wait and download tomorrows night build then. (In reply to comment #68) > It's not so easy, first it will take some time to propagate the patch from > jet-main repository to golden-main from which the night builds are done (mostly > it takes a day). Then it will be available in the dev (night) build.
Fixed missed persistence.xml change. jet-main a8fb9f0b3823
tested in web-main and it works for attached project after resolving missed references, thanks. it's in main-golden already and should be in next nightly.
thanks surgey, i will download as as soon as is available. there is one more thing i would to ask. when iam importing an innodb database with relationships. there is a small issue with the @ManyToOne relationships naming conversion. for example: private Person personID; isnt it more correct to be renamed automatically to the following? private Person person. because everytime new entities are created by netbeans i have to go and change the all the manytoone and onetomany variables and getter setters. i assume this is on the eclipselink site instead of netbeans. Am i correct? (In reply to comment #71) > tested in web-main and it works for attached project after resolving missed > references, thanks. > it's in main-golden already and should be in next nightly.
It should be netbeans issue, but I'm not sure if it's an issue yet, is there any problems with personID?
thanks for your response, for example if there is a @manytoone relationship between between an address entity and a person entity. using Expression Language in jsf file, if we want to access the PersonId with out any changes after entity generation we have to write address.details.personID.personID but what is the logical way to write is address.details.person.personID. i just created entities using a relational database i have in innodb and i check all the entities generated, i found out that i have an entity with a combined primaryID, and all its fields and getter and setters are generated the way its supposed to be, i will paste a couple of lines. public class Tarrif implements Serializable { private static final long serialVersionUID = 1L; @EmbeddedId protected TarrifPK tarrifPK; @JoinColumn(name = "CallDestinationID", referencedColumnName = "CallDestinationID", nullable = false, insertable = false, updatable = false) @ManyToOne(optional = false) private Calldestination calldestination; @JoinColumn(name = "CallEventID", referencedColumnName = "CallEventID", nullable = false, insertable = false, updatable = false) @ManyToOne(optional = false) private Callevent callevent; //more many to one attributes public Tarrif() { } public Tarrif(TarrifPK tarrifPK) { this.tarrifPK = tarrifPK; } public Calldestination getCalldestination() { return calldestination; } public void setCalldestination(Calldestination calldestination) { this.calldestination = calldestination; } public Callevent getCallevent() { return callevent; } public void setCallevent(Callevent callevent) { this.callevent = callevent; } //more manytoone getter and setters i will now paste a couple of lines from a normal entity without a compine key (In reply to comment #73) > It should be netbeans issue, but I'm not sure if it's an issue yet, is there > any problems with personID?
thanks for your response, for example if there is a @manytoone relationship between between an address entity and a person entity. using Expression Language in jsf file, if we want to access the PersonId with out any changes after entity generation we have to write> address.details.personID.personID but what is the logical way to write is address.details.person.personID. i just created entities using a relational database i have in innodb and i check all the entities generated, i found out that i have an entity with a combined primaryID, and all its fields and getter and setters are generated the way its supposed to be, i will paste a couple of lines. public class Tarrif implements Serializable { private static final long serialVersionUID = 1L; @EmbeddedId protected TarrifPK tarrifPK; @JoinColumn(name = "CallDirectionID", referencedColumnName = "CallDirectionID", nullable = false, insertable = false, updatable = false) @ManyToOne(optional = false) private Calldirection calldirection; @JoinColumn(name = "CallEventID", referencedColumnName = "CallEventID", nullable = false, insertable = false, updatable = false) @ManyToOne(optional = false) private Callevent callevent; //more many to one attributes public Tarrif() { } public Tarrif(TarrifPK tarrifPK) { this.tarrifPK = tarrifPK; } public Calldirection getCalldirection() { return calldirection; } public void setCalldirection(Calldirection calldirection) { this.calldirection= calldirection; } public Callevent getCallevent() { return callevent; } public void setCallevent(Callevent callevent) { this.callevent = callevent; } //more manytoone getter and setters i will now paste a couple of lines from a normal entity without a compinekey public class Calldirection implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "CallDirectionID", nullable = false) private Integer callDirectionID; @Basic(optional = false) @Column(name = "CallDirectionName", nullable = false, length = 255) private String callDirectionName; @JoinColumn(name = "NetworkID", referencedColumnName = "NetworkID", nullable = false) @ManyToOne(optional = false) private Network networkID; public Calldirection() { } public void setDisplay(Boolean display) { this.display = display; } public Network getNetworkID() { return networkID; } .................................. the Calldirection entity's manytoone attributes should be generated the same way as teh tarrif entity.(for example private Network networkId => private Network network isn't that correct? thanks in advance
It may be better to open new one issue, for this case. I need to recheck with specification but it looks like just a usability issue, if it cause no fails.
thanks, it can be very helpful and time saving specially when creating entities from a very large database with complex relationships. i assume this issue its going to be opened at your end correct? (In reply to comment #76) > It may be better to open new one issue, for this case. > I need to recheck with specification but it looks like just a usability issue, > if it cause no fails.
(In reply to comment #27) > For Maven, the workaround that worked for me (starting with a Web project that > already uses persistence, has persistence.xml, has the EclipseLink dependencies > etc) is the following: <snip> Thanks you Petr Jiricka! :) Works first time
You are welcome, but note that this approach has problems if you have tests in your project. A newer approach is now possible, see bug 181861 where the Maven aspect is tracked separately.
http://hg.netbeans.org/web-main/rev/6297551e6111 eclipselink is upgraded to 2.1.0-M7.
hi i installed the latest development build(20100525001), this version has the same issue as per our previous descussion. it builds but it does not deploy after metamodel generation. in order to deploy i have to tick Run/Deploy on save. thanks (In reply to comment #53) > yes, it's an issue considered as a feature, but may be there is an issue with > update of old projects, > jpa2.0/annotation processor suppose source level is jdk6, update your project > properties to jdk6. > Also see compile section if both checkboxes related to ap ae selected.
Thanks for the heads up - but could you please file this problem as a separate bug report, so we don't mix too many things in one report? Thanks.
should be fixed now with bundled el 2.1.0 http://hg.netbeans.org/web-main/rev/894a6fea51ab we may need to decide if it need to be ported to 6.9.1 having in mind issues like #187653 and may be more.
Thanks - and you are right, bug 187653 is really nasty and we probably don't want to put this in 6.9.1 because of this bug.
We was able to decrease the impact of the bug 187653 by caching the processor. This also significantly speeds up the class generation but there is still the memory leak (VM issue).
Integrated into 'main-golden', will be available in build *201006250001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/894a6fea51ab User: Sergey B. Petrov <sj-nb@netbeans.org> Log: fix #178108 uupdate to el 2.1.0 release