package com.ankurm.hibernatedemo.mappingstyle; /** * Zero annotations. Mapped entirely by {@code mapping-xml-natural-id.xml}, using Hibernate's * native "mapping.xml" XML dialect (namespace {@code http://www.hibernate.org/xsd/orm/mapping}, * schema {@code mapping-7.0.xsd}) -- NOT the JPA-standard orm.xml dialect, which has no * <natural-id> element at all. Proves a Hibernate-only concept (@NaturalId) can be expressed * in XML, just not in the portable JPA orm.xml XSD. * *

Docs: docs/04-annotations-vs-xml.md, Topic 1 ("what XML can do that annotations cannot" -- * inverted: what one XML dialect can do that the other XML dialect and annotations both cannot * express the same way). */ public class MappingXmlNaturalIdEntity { private Long id; private String sku; private String name; public MappingXmlNaturalIdEntity() { } public MappingXmlNaturalIdEntity(String sku, String name) { this.sku = sku; this.name = name; } public Long getId() { return id; } public String getSku() { return sku; } public String getName() { return name; } }