Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EQNA6DJ9VgCtW6zhCE8Xud
40 lines
1014 B
Java
Executable File
40 lines
1014 B
Java
Executable File
package com.ankurm.hibernatedemo.proxy;
|
|
|
|
import jakarta.persistence.Entity;
|
|
import jakarta.persistence.GeneratedValue;
|
|
import jakarta.persistence.GenerationType;
|
|
import jakarta.persistence.Id;
|
|
|
|
/**
|
|
* The default-fetch-type EAGER side of the entity-graph demo in docs/11-proxies-and-lazy-initialization.md
|
|
* (fetchgraph vs loadgraph). {@link ProxyBook#publisher} points here with the default
|
|
* {@code @ManyToOne} fetch type, which is EAGER -- deliberately, so that a
|
|
* {@code jakarta.persistence.fetchgraph} hint has something to force back to LAZY that a
|
|
* {@code jakarta.persistence.loadgraph} hint leaves alone.
|
|
*/
|
|
@Entity
|
|
public class ProxyPublisher {
|
|
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
private Long id;
|
|
|
|
private String name;
|
|
|
|
protected ProxyPublisher() {
|
|
// JPA
|
|
}
|
|
|
|
public ProxyPublisher(String name) {
|
|
this.name = name;
|
|
}
|
|
|
|
public Long getId() {
|
|
return id;
|
|
}
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
}
|