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:
@@ -0,0 +1,27 @@
|
||||
package com.ankurm.hibernatedemo.proxy;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* Test-only support for docs/11-proxies-and-lazy-initialization.md's OSIV chapter (OsivMaskingTest). Returns the
|
||||
* managed entity directly (not a DTO) ON PURPOSE -- Jackson's serialization of
|
||||
* {@code getReviews()} on the response-writing thread is the exact moment open-in-view either
|
||||
* saves you (session still bound, proxy initializes) or doesn't (session long closed,
|
||||
* LazyInitializationException).
|
||||
*/
|
||||
@RestController
|
||||
public class OsivBookController {
|
||||
|
||||
private final OsivBookService service;
|
||||
|
||||
public OsivBookController(OsivBookService service) {
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
@GetMapping("/osiv/books/{id}")
|
||||
public ProxyBook getBook(@PathVariable Long id) {
|
||||
return service.findBook(id);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user