[hibernate-dev] Hibernate mapping deprecation
steve at hibernate.org
Thu Sep 8 10:03:25 EDT 2016
Yes that will happen:
But not any time soon. Basically we will support an "extended" version of
the JPA orm.xml schema that introduces Hibernate specific concepts.
Historically we stayed away from that because IMO it really is against the
spirit, in not the letter, of the JPA spec. However, IIUC this is exactly
what other JPA providers do. So we will go that route.
For a short time we will continue to support hbm.xml files even after 7.0
*to a point*. There are certain hbm.xml concepts that simply do not map
well to JPA - things JPA handles differently. The main one that comes to
mind is property-ref. There will be a "converter" for converting hbm.xml
-> orm.xml. The intention is to allow build-time conversion of hbm.xml
files to the corresponding orm.xml. For a short time we will continue to
support that conversion on the fly at runtime too. Handling of any
non-supported constructs (property-ref, e.g.) is still being discussed.
For sure as part of the on-the-fly runtime conversion it wouyld result in
an exception. For the build-time tool though we'd ideally inject a comment
of some sort into the generated file and log a warning; the difficulty with
that is that JAXB (to my limited knowledge, at least) does not provide a
way to inject an XML comment somewhere in the doc.
Also, keep in mind that a lot of this conversion work is already done on a
branch. Ideally I would love to offer the "extended orm.xml" feature in
6.x (for some x > 0). So even as part of 6.x you'd be able to play around
with that. TBD exactly when we'd drop support for hbm.xml altogether;
obviously some point after 7
On Thu, Sep 8, 2016 at 8:46 AM Koen Serneels <ks at error.be> wrote:
> Hi Steve,
> You probably don’t remember me, but we spoke a while back on IRC about
> some stuff regarding hibernate5<->spring4 integration (like SF building)
> and inconsistencies between metadata build from Hibernate mapping files
> compared to their annotation equivalent. Anyway, if I remember correctly
> you mentioned something during our conversation that Hibernate wants to
> more or less deprecate Hibernate mapping files in the future. I would be
> thankful if you could shed some more light on this.
> To explain the situation: at the moment we are considering migrating our
> Hibernate XML mappings to annotations. But as we have a wrapper/super class
> structure with generics, we are trying to make this fit with annotations.
> However, while this might work (we are still testing, as we want to retain
> compatibility with our existing code) we were also thinking on using the
> JPA mapping format as we have the feeling this could be more elegant (to be
> honest, the mapping files never hurted us)
> Now, is it true that Hibernate is going to deprecate the Hibernate mapping
> format? And is using the JPA mapping format instead a sound (read: future
> proof) choice?
> Unless I’m mistaking, Hibernate as a JPA compliant provider, is supposed
> to continue supporting the JPA mapping format unless this would become
> deprecated in specs, which should not happen anytime soon, no?
> Thanks for your time
More information about the hibernate-dev