Hi my question is not technical. I want to know if hibernate 5 supports XML based entity mapping or not.
My requirement is like below :
I want a backend on Jersey-Hibernate. My front end is Android application. I want to keep my Entity POJOs in a common project such that they will be shared by both app and server. Gson will serialize/deserialize both side. But because android application doesn't support all java library in compilation, I don't want my common(POJO) depending on some library; In this case hibernate annotations. So I am planning to use XML based configuration.
Hibernate 5 supports both the legacy
HBM
mappings as well as the JPA XML mappings too. However,HBM
mappings are no longer the recommended approach to map entities. As illustrated in the new User Guide, all examples make use of annotations.There are more features provided by Hibernate-specific annotations than it is the case with
HBM
mappings. In Hibernate 6, it is planned to add an extension mechanism to the JPA XML mappings, thereforeHBM
mappings are deprecated.Since you are migrating to Hibernate 5, it's a good idea to migrate from
HBM
to annotations too.Yes, according to documentation (where authors recommended using annotations for mapping) is said that xml mapping is still possible: docs
So on - you can still us
*.hbm.xml
for entity mapping.EDIT: ofc I mean *.hbm.xml