What is Metamodel API used for

506 views Asked by At

I understand that metamodel is kind of an abstraction of entity classes, but what exactly it is and how can I profit from that?

1

There are 1 answers

2
lane.maxwell On BEST ANSWER

They're used for writing Criteria queries for JPA.

Also, it's used for writing Specifications (if you're using spring data)

Specification<Foo> isBar() {
    return (root, query, builder) -> builder.isNotNull(root.get(Foo_.bar));
}