HHH-20376: Replace the use of the hibernate-orm mapping API with hibernate-models#12247
HHH-20376: Replace the use of the hibernate-orm mapping API with hibernate-models#12247koentsje wants to merge 1271 commits into
Conversation
|
Thanks for your pull request! This pull request does not follow the contribution rules. Could you have a look? ❌ All commit messages should start with a JIRA issue key matching pattern › This message was automatically generated. |
|
Is this something you've been working on with @sebersole or... ? Because with these stats:
I don't think there's any way anyone will be able to give a proper review. We'll probably need to sit down and see:
|
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.Hbm2JavaEqualsTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.Hbm2JavaEjb3Test' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.JavaDidirectionalIndexedCollectionMappingTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.Hbm2JavaConstructorTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.Hbm2HibernateDAOTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.DocExporterTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.GenericExporterTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.HashcodeEqualsTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.Hbm2CfgTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.Hbm2DaoTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
- Also remove the 'language' module from the build Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.Hbm2EJBDaoTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.hbm2hbmxml.TypeParamsTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.hbm2hbmxml.SetElementTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.hbm2hbmxml.OneToOneTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.hbm2hbmxml.MapAndAnyTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.hbm2hbmxml.ManyToManyTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.hbm2hbmxml.ListArrayTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.hbm2hbmxml.JoinTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.hbm2hbmxml.InheritanceTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.hbm2hbmxml.IdBagTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.hbm2hbmxml.Hbm2HbmXmlTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.hbm2hbmxml.FormulaTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.hbm2hbmxml.DynamicComponentTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.hbm2hbmxml.CompositeElementTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.hbm2hbmxml.Cfg2HbmToolTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.hbm2hbmxml.BackrefTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…yTest' source tree in the 'orm' module - Move 'org.hibernate.tool.hbm2x.hbm2hbmxml.AbstractTest' Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Extract MappingQueryAndFilterHelper from MappingXmlHelper
(filters, named queries, fetch profiles, SQL DML, lifecycle callbacks)
- Add MappingQueryAndFilterHelperTest (24 tests)
- Remove 23 unused imports from MappingXmlHelper
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Extract MappingFieldAnnotationHelper from MappingXmlHelper
(field categorization, column attrs, generators, associations,
Any, ElementCollection, ordering, sort, property attributes)
- Add MappingFieldAnnotationHelperTest (99 tests)
- MappingXmlHelper is now a pure facade delegating to 3 helpers
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Extract OverrideStrategyDelegate from OverrideRepository
(234-line anonymous DelegatingStrategy becomes named class)
- Promote TypeMappingKey, TableColumnKey, TableToClassName inner
classes to top-level package-private files
- OverrideRepository reduced from 822 to 433 lines
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Add unit tests for Phase 8 extracted classes:
TypeMappingKeyTest (7 tests), TableColumnKeyTest (12 tests),
TableToClassNameTest (11 tests), OverrideStrategyDelegateTest (34 tests)
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Extract EntityAnnotationApplier from DynamicEntityBuilder
(@entity, @table, @Inheritance, @DiscriminatorColumn/Value,
@PrimaryKeyJoinColumn, unique constraints)
- Decompose createEntityFromTable (181 lines) into 12 focused
private methods (~10 lines each)
- Add EntityAnnotationApplierTest (13 tests)
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Extract DdlSchemaOperations from DdlExporter (278 lines)
(schema create/drop/both/update for writer and database targets,
execution options, source/target descriptors, metadata bootstrap)
- DdlExporter reduced from 477 to 265 lines, delegates via
one-liner methods
- Add DdlSchemaOperationsTest (4 tests)
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Extract DocTemplateRenderer from DocExporter (226 lines)
(FreeMarker config, template loading, processTemplate,
generateDot, copyResource, readFileContent)
- DocExporter reduced from 598 to 415 lines, delegates to
renderer for all template processing and DOT generation
- Add DocTemplateRendererTest (11 tests)
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Extract GenericTemplateProcessor from GenericExporter (274 lines)
(FreeMarker config, template processing, model building,
mode resolution, filename resolution, per-class/config export)
- GenericExporter reduced from 436 to 283 lines, delegates to
processor for all template engine concerns
- Add GenericTemplateProcessorTest (19 tests)
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Extract OracleQueryExecutor from OracleRevengDialect (563 lines)
(Oracle SQL constants, PreparedStatement management, ResultSet
construction for tables/indexes/columns/PKs/FKs, escape, cleanup)
- OracleRevengDialect reduced from 755 to 274 lines, delegates to
executor for all JDBC query infrastructure
- Add OracleQueryExecutorTest (16 tests)
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Split FreeMarker templates into cohesive includes:
properties.hbm.ftl → basic-property, many-to-one, collections, component
property-accessors.entity.ftl → basic, association, embedded accessors
main.dao.ftl → dao-ejb3, dao-session
- Defer doc template splits (entity.ftl, table.ftl) pending Models
API conversion
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Add capitalize to StringUtil, remove private copy from TemplateHelper
- Add isPrimitiveType to TypeHelper, consolidate from HbmTypeResolver
and EqualsHashCodeHelper
- Create CascadeUtil for shared HBM cascade formatting (consolidates
duplicates from HbmTemplateHelper and HbmCollectionAttributeHelper)
- Create HbmEnumMapper for shared Hibernate-to-JPA enum conversions
(consolidates duplicates from HbmEntityBehaviorBuilder,
HbmCollectionMetadataApplier, HbmFilterAndQueryBuilder,
HbmAssociationBuilder)
- Create FieldMetaUtil for shared field meta-attribute lookup
(consolidates duplicates from HbmFieldAttributeHelper,
HbmFieldCategorizationHelper, HbmCollectionAttributeHelper)
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Expose HBM delegate classes as per-template context objects
(classInfo, fields, fieldAttrs, collections, queries)
- Move association/join/cascade methods from HbmTemplateHelper to
HbmFieldAttributeHelper (39 methods)
- Move element collection/composite/any/properties-group methods
from HbmTemplateHelper to HbmFieldCategorizationHelper (16 methods)
- Move meta-attribute and import methods from HbmTemplateHelper to
HbmClassInfoHelper (4 methods)
- HbmXmlExporter adds delegates to FreeMarker model alongside helper
- Migrate all 8 HBM templates from helper.xxx() to named context
variables (classInfo, fields, fieldAttrs, collections, queries)
- HbmTemplateHelper reduced to thin backward-compat facade
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Expose mapping delegate classes as per-template context objects
(entityInfo, fieldInfo, queries)
- Make MappingEntityInfoHelper, MappingFieldAnnotationHelper,
MappingQueryAndFilterHelper public with public methods
- MappingXmlExporter adds delegates to FreeMarker model alongside
helper
- Migrate all 5 mapping templates from helper.xxx() to named context
variables (entityInfo, fieldInfo, queries)
- MappingXmlHelper reduced to thin backward-compat facade
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Expose entity delegate classes as per-template context objects
(classInfo, fieldAnnotations, relAnnotations, constructors,
equalsHashCode, meta, queries)
- Make all 7 entity delegate classes public with public methods
- EntityExporter adds delegates to FreeMarker model alongside
templateHelper
- Migrate 8 entity templates: annotation generation routed to
classInfo/fieldAnnotations/relAnnotations, meta attributes to
meta, equals/hashCode to equalsHashCode
- templateHelper retained for core methods (field listing, type
resolution, accessor names) and GenericExporter backward compat
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Construct delegate context objects directly in HbmXmlExporter and
MappingXmlExporter without going through facade classes
- Add per-template context objects to GenericExporter model so entity
templates work via GenericExporter/ant tasks
- Facade classes retained for backward compatibility and 7.4 backport
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Split HbmFieldAttributeHelper (625 lines) into HbmFieldAttributeHelper
(322, property/column/generator attrs) and HbmAssociationAttributeHelper
(355, ManyToOne/OneToOne/OneToMany/ManyToMany/JoinTable/JoinColumn)
- Split MappingFieldAnnotationHelper (667 lines) into
MappingFieldAnnotationHelper (266, field categorization/column attrs)
and MappingAssociationHelper (447, associations/ordering/Any/ElementCollection)
- Update 5 FreeMarker templates to use new assocAttrs/assocInfo model keys
- Update facade classes and exporter model wiring
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Inline ImportContextImpl into ImportContext, removing the unnecessary
interface/implementation split (single internal implementation)
- Delete ImportContextImpl, update all callers (13 files)
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Restructure packages for hibernate-orm layout: insert 'reveng'
segment (org.hibernate.tool.X → org.hibernate.tool.reveng.X)
- Apply HHH-19879 integration changes to gradle/maven plugins:
Extension → RevengSpec, AbstractTask → RevengTask, flatten
reveng.task package, delete standalone Plugin registration
- Add @deprecated(forRemoval=true) and warning to GenerateHbm
task and mojo
- Fix RunSqlTask: read credentials from properties instead of
hardcoded values, use try-with-resources
- Remove e.printStackTrace() calls from RevengTask
- Replace TestTemplate with orm-integrated version using
'org.hibernate.orm' plugin and hibernate { reveng { } } DSL
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Apply spotless formatting (SPDX headers, indentation)
- Fix brace style to match orm enforceRules (}\ncatch)
- Update imports: org.hibernate.tool.api → org.hibernate.tool.reveng.api,
org.hibernate.tool.util → org.hibernate.tool.reveng.util
- Delete unused stat classes (ColumnStatistics, TableStatistics)
- Fix API compatibility issues for orm integration
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Fix doubled test directories from filter-repo migration
(cfg/cfg, hbm2x/hbm2x, hbmlint/hbmlint, etc. → move files up one level)
- Fix doubled test resource directories (internal/reveng/reveng, internal/export/export)
- Update hardcoded resource paths to include reveng/ segment
- Update HBM mapping package declarations (org.hibernate.tool.hbm2x → org.hibernate.tool.reveng.hbm2x)
- Recover ModelCompletion test resources deleted in d18520e
- Add @AllowSysOut to DdlExporter console methods, fix javadoc errors
- Add testImplementation ':hibernate-ant' to hibernate-reveng.gradle
- Restore 15 deleted ant task classes with updated imports and SPDX headers
- Add pojo and getShortName() backward-compat aliases in GenericExporter/TemplateHelper
- @disabled tests incompatible with Hibernate 7 (EJB3Configuration, JPAPUnit,
NoConnInfoExport, AntHibernateTool.testHbm2DDLLogic, ExamplesTestIT)
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Fix remaining class references missing reveng. segment in HBM mapping
files (many-to-one, set, persister, type-param attributes)
- Uncomment HBX-2042 query definitions in BasicGlobals.hbm.xml
- Fix mapping XML template version from 8.0 to 7.0 (latest valid XSD)
- Re-enable 4 ant legacy tests (NoConnInfoExport, AntHibernateTool,
EJB3Configuration, JPAPUnit) — all pass without changes
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Restore docs/examples infrastructure from hibernate-tools
- Add Hbm2JavaTestIT and TutorialTestIT integration tests
- Re-enable ExamplesTestIT (adapt editIncludedXml for Gradle, clean
generated output between runs)
- Update example HelloExporter imports for reveng API package
Signed-off-by: Koen Aers <koen.aers@gmail.com>
…rnate-models
- Fix HBX-2054: handle array type names (e.g. String[], int[]) in HBM
mappings by converting [] syntax to JVM internal format in
MappingHelper.classForName()
- Uncomment array-typed properties in HashEquals.hbm.xml test resource
Signed-off-by: Koen Aers <koen.aers@gmail.com>
- Delegate reveng Version.versionString() to org.hibernate.Version - Update maven IT tests for hbm2orm goal rename - Fix NPE in SchemaByMetaDataDetector and SequenceCollector when database metadata contains null values Signed-off-by: Koen Aers <koen.aers@gmail.com>
1295b3d to
6aae873
Compare
…rnate-models
- Explicitly use the Xerces DocumentBuilderFactory implementation in
MetadataHelper and NativeMetadataDescriptor to avoid possible
ParserConfigurationException when Oracle JDBC driver's XML parser
is on the classpath
- Extract addMappingElement() to reduce cognitive complexity of
addCfgXmlMappings (SonarCloud S3776)
Signed-off-by: Koen Aers <koen.aers@gmail.com>
|
|
I gave the PR a quick look and it seems like there are lots and lots of formatting changes in it. Maybe we can start to bite off this PR by first merging the formatting only changes, without much review, and follow up with more targeted PRs? Or is that what #12258 is for and this PR can be closed? |
|
We discussed this with Koen yesterday, and we both agree the PR needs to be much, much more focused. There are a few mistakes here -- formatting changes yes, but also some refactorings that weren't intended -- and the scope is also probably too big. The current plan is to time-box work on a smaller change, for example one that would convert only part of Tools to hibernate-models, so that it can possibly be reviewed. And of course, without the formatting changes and refactorings. In the meantime... closing. |





By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.
Please make sure that the following tasks are completed:
Tasks specific to HHH-20376 (Task):
documentation/src/main/asciidoc/userguidefor all features,documentation/src/main/asciidoc/introductionfor main features, links from existing documentationmigration-guide.adoc(breaking changes) andwhats-new.adoc(new features/improvements)https://hibernate.atlassian.net/browse/HHH-20376