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:
+38
@@ -0,0 +1,38 @@
|
||||
package com.ankurm.hibernatedemo.namedquery;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.GenerationType;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import org.hibernate.annotations.NamedQuery;
|
||||
|
||||
/**
|
||||
* Uses {@code org.hibernate.annotations.NamedQuery} (the Hibernate extension, not the JPA
|
||||
* standard one) specifically to exercise an extra it offers that JPA's does not:
|
||||
* {@code cacheable = true}. Docs: 14-named-queries.md, chapter "jakarta vs hibernate NamedQuery".
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "hib_extra_employee")
|
||||
@NamedQuery(name = "HibernateExtraEmployee.cacheableFindAll",
|
||||
query = "SELECT e FROM HibernateExtraEmployee e",
|
||||
cacheable = true)
|
||||
public class HibernateExtraEmployee {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
protected HibernateExtraEmployee() {
|
||||
}
|
||||
|
||||
public HibernateExtraEmployee(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user