Add Hibernate 7 batches 2-6, batch 7, and batch 8: mapping styles, JPA annotations, natural IDs, @Immutable, stored procedures, in-memory test databases, JNDI mocking, proxies, associations, temporal mapping, named queries, HQL, Criteria API, EntityManager bootstrapping, Ehcache 3 L2 cache configuration, HikariCP connection pooling, Hibernate Validator CDI integration, aggregate functions, sorting, pagination, interceptors, and Hibernate Search 8 (Hibernate 7.4.5.Final + Spring Boot 4.1.1 + JDK 25)
This commit is contained in:
+39
@@ -0,0 +1,39 @@
|
||||
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.
|
||||
*
|
||||
* <p>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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user