borinquenkid commented on PR #16570:
URL: https://github.com/apache/grails-core/pull/16570#issuecomment-6205021208

   > @borinquenkid can you give history on this change and why it's required / 
should go into 9? We will likely release 9 at the end of Nov and this is a 
rather large change. Help me understand why we need this.
   This is the implementation of @sbglasius improvement for H7 binding.
   
   1. Generate Hibernate’s mapping model instead of building it by hand
   GrailsDomainBinder plugs in through AdditionalMappingContributor but ignores 
the contributions argument. It creates the internal 
MetadataBuildingContextRootImpl 
([GrailsDomainBinder.java:122](https://github.com/apache/grails-core/blob/80a1ff5637600e6e5fb9c34d983e9a734584c6b3/grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/GrailsDomainBinder.java#L122))
 and builds RootClass, BasicValue, Component and similar objects directly. Its 
Javadoc says it is based on HbmBinder, a binder Hibernate has since dropped.
   
   The mapping code under cfg/ is about 15k lines. The Hibernate 5 
GrailsDomainBinder was one 3.6k-line file.
   In 7.4, 
AdditionalMappingContributions.contributeBinding(JaxbEntityMappingsImpl) 
accepts an orm.xml model. Hibernate converts its own legacy hbm.xml into that 
model and binds everything through one binder.
   That model covers what GORM needs: tenant ids, natural ids, filters, 
generators, user types, caching, discriminators, element collections and order 
columns.
   I’d write a translator from GORM entities plus the static mapping DSL to 
that model, and let Hibernate own foreign keys, inheritance and collection 
keys. That means far less code, cheaper Hibernate upgrades, and a generated 
orm.xml to inspect when a user reports a mapping bug.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to