The background here is integrating my JPA 2.1 work in with the Hibernate
5.0 metamodel branch. One of the things the EntityManagerFactory does
when starting up is to build the JPA
javax.persistence.metamodel.Metamodel. Today that process leverages the
old Hibernate mapping code (org.hibernate.mapping). I will need to
re-write this to leverage the new org.hibernate.metamodel code. I
wanted to run the way I am thinking of attacking this past everyone to
get feedback. Basically I want to have the *SessionFactory* take over
responsibility for building it. 2 main reasons why:
1) First it would be more efficient. Today we loop over those mapping
objects at least twice: once to create the persisters as part of
SessionFactory building and then again later to build this JPA Metamodel
as part of EntiytManagerFactory building. Once is better than twice
when it comes to looping :)
2) I have this other idea where I'd really like to see JPA criterias
useable in "native" Hibernate usage (Session/SessionFactory). Which
would essentially require both javax.persistence.metamodel.Metamodel as
well as javax.persistence.criteria.CriteriaBuilder to be available.
Well technically any "criteria builder" that output the proper types
could work; and I guess Metamodel is not strictly needed to build
criterias aside from potentially populating the static generated
metamodel classes. But it would be nice to have them.
--
steve(a)hibernate.org
http://hibernate.org