[hibernate-dev] metamodel thoughts

Steve Ebersole steve at hibernate.org
Wed Jun 22 18:16:36 EDT 2011


Wanted to get my thoughts on the current state of the metamodel down so 
we could all discuss.

First to define some vocab for discussing.  I say that the old code 
(Configuration, HBMBinder/AnnotationBinder, mapping package) used a 
"push" model.  The binders interpreted the various user supplied values 
and made decisions *pushing* the results of those decisions to the 
mapping classes.  The new code attempts a "pull" approach.  The user 
values are interpreted into BindingState and RelationalState objects 
which get passed in to the Binding objects which *pull* the data from 
the states.

At the most basic of descriptions, what is it we are trying to 
accomplish here?  Well we have some mapping information supplied by the 
user in a number of forms (hbm, annotations, etc) and need to correctly 
build/populate a binding model based on the values and interpretations 
of those values.

In designing I always go back to the question of "how would I accomplish 
this task by hand".  Here, the first thing I see is that we have user 
values in multiple formats.  So the very first thing I would do, 
ideally, is to some how normalize values from those different "sources". 
  I would then take those normalized values and then populate the 
binding model.

So here is what I suggest:
1) What we currently call "state" objects would serve the role of this 
normalization.  We would have specific things to normalize hbm, 
annotations, etc.  It could even be just different implementations of 
the same normalized interface which are constructed with whatever they 
need to answer the contract queries.
2) These normalized value objects are then passed into THE binder which 
uses the information there to build and populate the bindings.  2 things 
to note here.  First I said THE binder.  The idea is that there is just 
one for both annotations and hbm as the differences were removed during 
normalization.  Second this part is a push approach.  Specifically that 
means the bindings and models are mutable.

In my mind this sits between push and pull (or does each)

-- 
Steve Ebersole <steve at hibernate.org>
http://hibernate.org



More information about the hibernate-dev mailing list