Skip to content

Commit 8eb544b

Browse files
committed
LazyCollection comments (to not load comments when just size needed)
1 parent 4c641d4 commit 8eb544b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/main/java/alexp/blog/model/Post.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ public class Post {
4646
@OrderBy("name ASC")
4747
private Collection<Tag> tags = new ArrayList<>();
4848

49-
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL, mappedBy = "post")
49+
@OneToMany(cascade = CascadeType.ALL, mappedBy = "post")
50+
@org.hibernate.annotations.LazyCollection(org.hibernate.annotations.LazyCollectionOption.EXTRA)
5051
@OrderBy("dateTime ASC")
5152
public List<Comment> comments = new ArrayList<>();
5253

0 commit comments

Comments
 (0)