JPA 2.0 Typesafe Criteria API and Annotation Processing HowtoNovember 19th, 2009 by Gregory Shrago
Maia build subsystem now recognizes Java Annotation Processors. Most of JPA 2.0 implementations are expected to make use of the Pluggable Annotation Processing API to automatically generate static metamodel classes. Here is a list of steps required to generate JPA 2.0 metamodel and keep it up-to-date with Hibernate Static Metamodel Generator. For the simplicity in this sample project the processor jar file is added to the module dependencies.
Now, Annotation processors will be run every time you invoke Make or Compile. Besides, there is a special menu item Process Annotations that does exactly what its name says. In this sample project I have added the generated directory to project sources to get completion in JPA 2.0 Typesafe Criteria API calls. Enjoy, Comment.
UPDATE: For all those having troubles configuring EclipseLink CanonicalModelProcessor here is the preconfigured sample project with plain JPA and Web+JPA modules.