|
|
|
|
|
|
h3. Overview
Per the subject, develop an XSD that allows mixing JPA orm.xml elements and Hibernate-specific features. It is important that this "unified" XSD be able to validate spec-compliant mapping documents (aside from considerations listed below).
In my limited understanding
{{hbm.xml}} as a format will be deprecated. There is work underway on a transformation from {{hbm.xml}} format into this new unified mapping format. This transformation will be available as a build time tool. Additionally , there seems to this transformation will be 2 approaches:
1) Use available on- the XSD extends feature 2) Develop fly for the Hibernate namespace completely separately time being ( the mapping XML would mix namespaces though certainly adds overhead to Metadata building - startup ).
(2) allows See HHH-8894 for easier portability additional details.
Ultimately this allows us to internally have a singular view of mapping metadata via Jandex as a merging between providers iiuc because annotations and XML mapping. This is actually mandated and specified by JPA in terms of standard annotations and the xml would not refer standard XSD. BUt this work will also allow "Hibernate extensions" to become part of this equation.
h3. Spec Deviation Considerations
The main deviation is in regards to {{/entity-mappings/entity@class}} being required per the JPA XSD. We need to deviate from that to support dynamic models ( extended map mode atm ) Hibernate XSD as the root . But
h3. Usability considerations
Some things to consider from a usability PoV as I am not develop this..
h5. How to handle wrapping features?
Consider defining a natural id. In {{hbm.xml}} this is done sort of like a {{<component/>}} (because a natural id is internally handled as a dynamic composite): {code} <natural-id> <property .../> </natural-id> {code}
In terms of a direct translation into unified XSD this would look like: {code} <natural-id> <basic .../> </natural-id> {code}
Not sure how that is the best format for specifying a natural id here. So far this applies validation across is exactly how I have defined it in the combined namesapces XSD, but want to consider better alternatives. I have considered an attribute on the property elements: {code} <basic ... naturalId="true" /> {code}
But that is troublesome when the property elements are used in contexts other than at an entity level ( since they interleave composite map key, etc ). Having a wholly separate element to contain natural id information for the entity would work, but would lead to duplicating the property names: {code} <natural-id> <defined-by/> // lists attribute names // plus have caching strategy info </natural-id> {code}
|
|
|
|
|
|