concept Metamodel in category hibernate
appears as: Metamodel

This is an excerpt from Manning's book Java Persistence with Hibernate, Second Edition.
The Metamodel API has been added. You can obtain (unfortunately not change) the names, properties, and mapping metadata of the classes in a persistence unit.
Path: /examples/src/test/java/org/jpwh/test/simple/AccessJPAMetamodel.java
Metamodel mm = entityManagerFactory.getMetamodel(); <enter/> Set<ManagedType<?>> managedTypes = mm.getManagedTypes(); assertEquals(managedTypes.size(), 1); <enter/> ManagedType itemType = managedTypes.iterator().next(); assertEquals( itemType.getPersistenceType(), Type.PersistenceType.ENTITY );You can get the Metamodel from either the EntityManagerFactory, of which you typically have only one instance in an application per data source, or, if it’s more convenient, from calling EntityManager#getMetamodel(). The set of managed types contains information about all persistent entities and embedded classes (which we’ll discuss in the next chapter). In this example, there’s only one: the Item entity. This is how you can dig deeper and find out more about each attribute.