I started work on SQM-24 which covers translation of criteria queries into
The difficulty with this is that the JPA contracts alone do not give enough
information to really be able to understand the semantics of the query;
there is just not enough information exposed. I can get into specific
examples if that helps, but for now lets take that as a given...
So then how do we go about translating a criteria into an SQM? There are
going to be 2 main approaches. Each requires some level of extension to
the standard contracts:
The first approach is to use visitation. The criteria nodes would be
expected to implement an SQM extension accepting a visitor and do the right
thing. The gains here are the normal gains with the visitor pattern. The
downside is that this makes SQM highly dependent on the criteria impl doing
the right thing and makes the criteria impl sensitive to SQM (depending n
how we expose the visitation methods to a degree).
The second approach would be to extended the standard criteria contracts to
more fully cover the semantic. As one example, JPA defines just Predicate
(for the most part) without exposing the type of predicate. Is it a LIKE
expression? A BETWEEN? A Comparison (=, !=, <, etc)? We just don't know
from the standard contracts. So we'd have to develop a full semantic
extension model here. `interface LikePredicate extends Predicate`,
`BetweenPredicate extends Predicate`, etc.
I lean towards the visitor approach given these choices. Anyone else have
opinions? Other options?
I'm migrating from Hibernate4 to 5(RC4). While doing so I'm stumbling on
some stuff that has been removed or moved.
- In Hibernate4 we modified mappings on-the-fly by overriding Spring's
Doing so we could first access the getClassMapping on
org.hibernate.cfg.Configuration before letting the SF actually build.
However, in Hibernate5 the metadata access has been refactored and is no
longer part of the Configuration. Should we use MetadataContributor instead
for these purposes?
- Is there a way to register MetadataContributor dynamically? I see that it
is being loaded using Java's ServiceLoader.
However, I need some programmatic API access to enable or disable the
Contributor (for example based on Spring profiles).
- For JTA integration we were using
this class is no longer present.
Also in org.hibernate.cfg.AvailableSettings the key that was used
(hibernate.transaction.factory_class) to configure the factory is also
Is hibernate.transaction.coordinator_class the new key we should be using
natorImpl as value for JTA?
Do we need to configure anything special in case of resource local TX or is
JdbcResourceLocalTransactionCoordinatorImpl the default?
- generateDropSchemaScript and generateSchemaCreationScript have been
removed from Configuration. Is there a way to access this in another way?