On Thu 2014-02-06 21:08, Emmanuel Bernard wrote: > > On 06 Feb 2014, at 14:52, Steve Ebersole <st...@hibernate.org> wrote: > > > > > On Thu, Feb 6, 2014 at 7:01 AM, Emmanuel Bernard <emman...@hibernate.org> > > wrote: > > For OGM the impact is less but in > > Integrator.integrate > > we use Configuration to be able to conditionally add a naming strategy > > configuration.setNamingStrategy(). > > See this actually illustrates the problems with Configuration, so thanks > > for that :). Setting the naming strategy there would have had no effect > > because its "too late in the game". And there is really no corollary in > > the new code because of that (setting the naming strategy is available > > earlier). > > > > > You are right, it looks like we do set it in our custom persistence provider > impl for JPA and in OgmConfiguration otherwise. > How can I set naming strategy in a transparent fashion to people in the new > code way? OgmConfiguration will be gone in the new scheme.
I have been thinking about it more. Assuming we don't want to create specific subclasses in the new approach like we did with OgmConfiguration, we will need to ask the user to express the fact that he wants to use OGM instead of ORM. This could be by adding a specific property, adding a specific service in the registry etc. With that flag, we then need to do a few checks and set a few options: - set a naming strategy - set a datasource name (that might change with the new code but was required to avoid an error before) - set an identifier generator strategy provider - use the new id generator mappings - disable query startup checking (until we have a hook to add our own native query syntax checking logic) - set some Hibernate Search properties So it seems that from a property or service set by the user, OGM needs to be able to set a few properties and options (see above) transparently. And from what Steve says, it has to be done very early on. I would love a centralize approach somewhat tied to Integrator. The alternative is a nasty static method accepting the Hibernate ORM bootstrap objects and modify them. But then the user has to call this static method :( //some signature like that I suppose, not really expert in the new //bootstrap approach static MetadataBuilder enableOGM(ServiceRegistry registry, MetadataSources metadataSources) { ... } Emmanuel _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev