[hibernate-dev] Building the unified (orm.xml with Hibernate extensions) mapping schema
Steve Ebersole
steve at hibernate.org
Thu Feb 6 14:23:15 EST 2014
With HHH-8893[1] I am working on building the unified XSD for mapping
information. I have mentioned this a few times. HHH-8894[2] is related to
this.
Part of HHH-8894 is this idea to handle legacy hbm.xml documents as if they
were defined using this new XSD. Initially I had planned on using XSLT to
manage this. And in fact I started writing it as I was adding the
Hibernate extensions to the new unified XSD.
The "problem" is that XSLT is "not my thing". And so while some folks
could probably whip together the XSLT to accomplish this is a short time, I
find it taking me quite a long time. Not to mention that when it comes to
debugging problems with these transformations, I will be even more lost.
So I got to thinking about alternatives. Ultimately we are dealing with
JAXB. So we have a nice object model for these schemas (currently for the
standard JPA orm.xml schema and for the hbm.xml schema, I'll build the
"unified" one as I develop). The thought that occurred to me was to
leverage these 2 models to perform the transformation:
1) Read the hbm.xml and bind to its JAXB model
2) Walk this bound model and start building the unified mapping JAXB model
This still facilitates both of the usages I wanted from XSLT. In terms of
a build-time tool, we'd do the above steps and right the unified mapping
out to file. In terms of on-the-fly translation, well, we have the unified
mapping JAXB model, we'd just use it.
WDYT? If anyone feels very strongly about using XSLT for this, I am happy
to accept help :)
[1] https://hibernate.atlassian.net/browse/HHH-8893
[2] https://hibernate.atlassian.net/browse/HHH-8894
More information about the hibernate-dev
mailing list