[hibernate-dev] [OGM] Precedence of options specified on different levels

Emmanuel Bernard emmanuel at hibernate.org
Tue Dec 3 12:36:05 EST 2013


On Tue 2013-12-03 17:48, Gunnar Morling wrote:
> Thanks, Davide.
> 
> 2013/12/3 Davide D'Alto <davide at hibernate.org>
> 
> > It looks good to me.
> >
> 
> Ok.
> 
> > I first didn't like that but I came to think it makes sense, if the
> > property name conveys that semantics, e.g. "defaultAssociationStorageMode".
> >
> > I don't think it's necessary to use the prefix "default". For me it is
> > just a setting that it is overridden by something else in some situations,
> > the same as an annotation is declared at the same time on the class and on
> > an attribute.
> >
> 
> >From what I can say it's reasonable for a user to expect that properties
> given via persistence.xml or similar actually do apply and are not
> overridden by code or annotations.
> 
> Take the MongoDB "host" as example, here we have an internal constant with
> a default but the user can set "hibernate.ogm.mongodb.host" and this
> setting applies. That's different from the proposed algorithm where the
> property really would only be used as fallback if not configuration is
> given by means of annotations or API.
> 
> Thus I think it makes sense to make this semantics transparent via the
> "default..." prefix in the property name.

Realize guys that we have a sparse matrix model. Not all settings will
be applicable globally AND per entity AND per property.
host for example, probably should not have a entity/property level. We
might want to allow for it to be set programmatically globally but in
that case, I'd argue that the program should have priority over the XML.


More information about the hibernate-dev mailing list