-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Labels
bugSomething isn't workingSomething isn't working
Description
<div th:text="${#request.getAttribute(requestAttributeName)}">
Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: com.example.bootstrap4demo.Customer.address, could not initialize proxy - no Session
at org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:602) ~[hibernate-core-5.4.0.Final.jar:5.4.0.Final]
at org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:217) ~[hibernate-core-5.4.0.Final.jar:5.4.0.Final]
at org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:581) ~[hibernate-core-5.4.0.Final.jar:5.4.0.Final]
at org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:148) ~[hibernate-core-5.4.0.Final.jar:5.4.0.Final]
at org.hibernate.collection.internal.PersistentSet.toString(PersistentSet.java:327) ~[hibernate-core-5.4.0.Final.jar:5.4.0.Final]
Sample code
@Data
@Entity
class Customer {
@Id
@GeneratedValue
private Long id;
private String fullName;
private String username;
@NotBlank
private String email;
private String password;
private LocalDate birthDate;
private Integer age;
private Boolean adult;
@ElementCollection
private Set<String> address;
private Role role;
}
in controller:
model.addAttribute("customers", customerRepository.findAll());
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working