Koen De Jaeger (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HHH-16745 (
https://hibernate.atlassian.net/browse/HHH-16745?atlOrigin=eyJpIjoiMTllYT...
)
Re: TransientObjectException when loading versioned entity from second-level cache with
@OneToOne LAZY mapping (
https://hibernate.atlassian.net/browse/HHH-16745?atlOrigin=eyJpIjoiMTllYT...
)
Hello, I have the same stacktrace when fetching data, after upgrading to spring boot
3.1.x. I tried now with spring boot 3.1.1-SNAPSHOT and override hibernate to version
6.2.5.Final but still go the same error. When I remove @Version , the stacktrace
dissapears.
@Entity
@Table(name = "users")
@JsonIgnoreProperties(ignoreUnknown = true)
public class User implements Serializable {
@Id
@SequenceGenerator(name = "user_seq", sequenceName = "user_seq",
allocationSize = 1)
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "user_seq")
@JsonIgnore
private Long id;
@Column(updatable = false, insertable = false, columnDefinition = "varchar")
@Generated(event = EventType.INSERT, sql = "uuid_generate_v4()")
@JsonProperty("id")
@JsonView({Views.UserListManagement.class})
private String uuid;
@Version
@JsonView({Views.UserListManagement.class})
private Date modified;
@JsonIgnore
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "saved_by")
private User savedBy;
...
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
@JsonView({Views.UserDetail.class})
public String getSavedByUsername() {
if (savedBy != null && savedBy.getUsername() != null) {
return savedBy.getUsername().replace("(a)vluchtelingenwerk.nl",
"");
} else {
return null;
}
}
public void setSavedBy(User savedBy) {
this.savedBy = savedBy;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
User user = (User) o;
return id.equals(user.id);
}
}
(
https://hibernate.atlassian.net/browse/HHH-16745#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16745#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100227- sha1:8ffa416 )