Community
Participate
Working Groups
This enhancement request will track any work surrounding creation of an ATP tooling library and/or extension or use of an ATP tooling library as part of the JPA 2.0 RI. >This work is separate from the MetaModel API implementation work in bug# 266912 See the Metamodel design doc section below for Req#2. http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/metamodel_api#ATP_Tooling_Library
Include the following groups in the design phase. Eclipse IDE, Dali and other IDE tool implementations like NetBeans, RAD and JDeveloper
Changing priority to P@ since JPA 2.0 features are required for the 2.0 release
Created attachment 141892 [details] APT (Java SE 1.5) processor test implementation (11 Mar 2009) >This patch is an export of an Eclipse 3.4 project where we test an APT implentation based on the 1.5 example. >see http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/metamodel_api#Running_APT_to_create_AnnotationProcessorFactory_classes
Created attachment 143904 [details] Initial development check-in This is the first check-in of the APT processor. It is still a work in progress and has a number of known issues left to address, that is: 1 - Generic type support Employee<T> etc. 2 - Location of persistence.xml file through the -A attribute 3 - Support for generating classes in a new package 4 - Allowing configuration to use something other than the "_" on generated classes. 5 - Inheritance generation works on a whole model. When adding a child class followed by a parent class, the generation is not correct. Even with a forced change to the child class. 6 - Set method signatures and get method return types must match. That is, public Collection<Employee> getEmployees() public void setEmployees(Collection<Employee> employees) is ok, this is not: @OneToMany(targetEntity=Employee.class) public Collection getEmployees() public void setEmployees(Collection<Employee> employees) The processor as is today, requires minimal changes to the existing jpa metadata processing code, therefore, remains almost entirely its own entity with mininal hooks into the JPA metadata processing mode. These hooks should not affect existing jpa tests etc.
Created attachment 144078 [details] Canonical model processor updates Changes include removing the ASM factory dependency from the canonical model processor. Common factory logic has been extracted to an abstract level that both the ASM and Mirror factories extend. Each factory can maintain their own non generic logic used during processing. These changes also correct point #6 above.
Created attachment 144656 [details] More development updates Another development stamp. Includes support for generating properties and fields that use Type variables. Work begun to accept a user provided location of the persistence.xml.
Created attachment 145120 [details] A proposal for initializing the canonical model
Created attachment 145271 [details] Development update Includes code changes to allow the users to specify a different qualifier to use with the canonical source generation. Also allows the users to specify its location. New properties added to the persistence.xml are as follows: eclipselink.canonical-model.qualifier eclipselink.canonical-model.qualifier-position These same properties can be passed to the processor through the -A option. Properties specified in the persistence.xml file will override those from the -A option though.
Created attachment 145274 [details] Service file for canonical model processor This is the service file that will eventually be used to kick off the canonical model processor. Currently it just gets built into the C:\Work\eclipse\plugins\EclipseLink_modelgen_2.0.0.qualifier.jar
Created attachment 145679 [details] Development update Corrects point #5 above and processing of classes in the default package (index out of range exception)
Created attachment 145955 [details] Development update Addresses the following issues: - IOException when orm.xml is not found. - Centralizes the building of the canonical names (fully qualified) minus the user specified model generation package option (next drop)
Created attachment 145957 [details] Missed an update in the last patch
Created attachment 146281 [details] Development update Patch addresses point #3: being able to generate the model in a different package. Also fixes a NPE bug found when processing embeddable classes.
Created attachment 146518 [details] Development update
Formed submitted early on me .. Patch above includes moving the canonical name logic off our internal persistence unit info and adds the processing and mapping of canonical classes to its related model classes. Both used during initialization.
Created attachment 147717 [details] Development update The patch provides the implementation of the following properties and their related behavior: - eclipselink.persistencexml This optional property specifies the full resource name to look for the persistence XML files in. If not specified the default META-INF/persistence.xml will be used. Note: For now this property is used for the canonical model generator but it can later be used as a system property for customizing weaving and application bootstrap usage. - eclipselink.persistenceunits This optional property specifies the set of persistence unit names that will be used when generating the canonical model. By default all persistence units available in all persistence XML files will be used. The value of this property is a comma separated list. When specifying multiple persistence units it is not possible to have persistence units with a comma in their name. Note: In the future this property can also be used to limit the persistence units that will be processed by the static or dynamic weaving. - eclipselink.canonicalmodel.prefix This optional property specifies the prefix that will be added to the start of the class name of any canonical model class generated. By default the prefix is not used. - eclipselink.canonicalmodel.suffix This optional property specifies the suffix that will be added to the end of the class name of any canonical model class generated. By default the suffix value is "_". If this property is specified the value must be a non-empty string that contains valid characters for use in a Java class name. - eclipselink.canonicalmodel.subpackage This optional property specifies a sub-package name that can be used to have the canonical model generator generate its classes in a sub-package of the package where the corresponding entity class is located. By default the canonical model classes are generated into the same package as the entity classes.
I tried to get the annotation processor working for testing purposes - with little luck: * If no "META-INF/persistence.xml" is found, it will raise a FileNotFoundException (actually it will eat the FNFE and throws a less informative RuntimeException). However, not all code dirs contain a persistence unit * META-INF/persistence.xml is searched for in StandardLocation.CLASS_OUTPUT - not a quite probable place in real projects' build systems for this file. Maybe the source path and the actual class path can be considered here as well. * javac -sourcepath option does not seem to be honored * eclipselink.persistencexml parameter does not handle absolute paths * And last but not least: CanonicalModelProcessor, ll. 369-373 for (StackTraceElement stElement : e.getStackTrace()) { processingEnv.getMessager().printMessage(Kind.NOTE, stElement.toString()); } throw new RuntimeException(e); Please do not log and rethrow exceptions, bug 239829.
I tried to get the annotation processor working for testing purposes - with little luck: * If no "META-INF/persistence.xml" is found, it will raise a FileNotFoundException (actually it will eat the FNFE and throws a less informative RuntimeException). However, not all code dirs contain a persistence unit >> This is as designed. Please log a separate enhancement request. * META-INF/persistence.xml is searched for in StandardLocation.CLASS_OUTPUT - not a quite probable place in real projects' build systems for this file. Maybe the source path and the actual class path can be considered here as well. >>> This is as designed. Please log a separate enhancement request. * javac -sourcepath option does not seem to be honored >>> This is as designed. Please log a separate enhancement request. * eclipselink.persistencexml parameter does not handle absolute paths >>> This is as designed. Please log a separate enhancement request. * And last but not least: CanonicalModelProcessor, ll. 369-373 for (StackTraceElement stElement : e.getStackTrace()) { processingEnv.getMessager().printMessage(Kind.NOTE, stElement.toString()); } throw new RuntimeException(e); Please do not log and rethrow exceptions, bug 239829. >>> This is as designed. Please log a separate enhancement request. This is in place purely to aid in debugging any errors raised during the model generation. This bug was created for the development of this feature. That cycle is now finished and I am closing this bug.
And just to elaborate further on some of your enhancement requests: * If no "META-INF/persistence.xml" is found, it will raise a FileNotFoundException (actually it will eat the FNFE and throws a less informative RuntimeException). However, not all code dirs contain a persistence unit >> This is a JPA 2.0 feature. All JPA persistence units require a persistence.xml which we use to determine which classes could possibly be used with the JPA 2.0 criteria api. NOTE: we will model gen for 1.0 persistence units as well. We did not expand the model gen to non-jpa projects. * META-INF/persistence.xml is searched for in StandardLocation.CLASS_OUTPUT - not a quite probable place in real projects' build systems for this file. Maybe the source path and the actual class path can be considered here as well. * javac -sourcepath option does not seem to be honored >> In our research of the APT library we found that the CLASS_OUTPUT and SOURCE_OUTPUT where the only 'required to be supported' locations. Our testing of the other locations revealed that sun's javac did not yet support the other location of: - ANNOTATION_PROCESSOR_PATH - CLASS_PATH - PLATFORM_CLASSPATH - SOURCE_PATH * eclipselink.persistencexml parameter does not handle absolute paths >> Again this seemed to be an APT library limitation (base on the available locations mentioned above).
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink