The legacy XML mapping documentation seems to be removed since Hibernate 5.But you can still find its documentation in the Hibernate 4 documentation, section 5.
And it is true when using hbm.xml
, if you don't need to map a field or a method , just do not include it in hbm.xml
. I cannot find this behavior is mentioned explicitly in the documentation as I think it is a common sense for people to think it back to the time when there is only legacy XML mapping.
And after introducing annotation mapping , it introduced the features that the mapping fields will be auto-detected by default which does not require to explicitly declare all mapping fields . The differences of this behaviour between legacy XML and annotation mapping are somehow mentioned in the documentation implicitly as follows:
You need to decide which property needs to be made persistent in a
given entity. This differs slightly between the annotation driven
metadata and the hbm.xml files.
In the annotations world, every non static non transient property
(field or method depending on the access type) of an entity is
considered persistent, unless you annotate it as @Transient. Not
having an annotation for your property is equivalent to the
appropriate @Basic annotation.