Search
Hibernate Metamodel Generator

Hibernate Metamodel Generator

Relational Persistence for Java and .NET

Hibernate Metamodel Generator

JPA 2 defines a new typesafe Criteria API which allows criteria queries to be constructed in a strongly-typed manner, using metamodel objects to provide type safety. For developers it is important that the task of the metamodel generation can be automated. Hibernate Metamodel Generator is an annotation processor based on the  Pluggable Annotation Processing API with the task of creating JPA 2 static metamodel classes. The following example shows how the metamodel class for the class Order looks like:

 

	
@Entity
public class Order {
@Id
@GeneratedValue
Integer id;
@ManyToOne
Customer customer;
@OneToMany
Set<Item> items;
BigDecimal totalCost;
// standard setter/getter methods
}

	
@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;
}