How to generate the JPA entity Metamodel?

Andrey picture Andrey · Jun 14, 2010 · Viewed 105.9k times · Source

In the spirit of type safety associated with the CriteriaQuery JPA 2.0 also has an API to support Metamodel representation of entities.

Is anyone aware of a fully functional implementation of this API (to generate the Metamodel as opposed to creating the metamodel classes manually)? It would be awesome if someone also knows the steps for setting this up in Eclipse (I assume it's as simple as setting up an annotation processor, but you never know).

EDIT: Just stumbled across Hibernate JPA 2 Metamodel Generator . But the issue remains since I can't find any download links for the jar.

EDIT 2: Awhile has passed since I asked this question, but I thought I'd come back and add a link to the Hibernate JPA Model Generator project on SourceForge

Answer

Pascal Thivent picture Pascal Thivent · Jun 14, 2010

It would be awesome if someone also knows the steps for setting this up in Eclipse (I assume it's as simple as setting up an annotation processor, but you never know)

Yes it is. Here are the implementations and instructions for the various JPA 2.0 implementations:

EclipseLink

Hibernate

OpenJPA

DataNucleus


The latest Hibernate implementation is available at:

An older Hibernate implementation is at: