|
When you have a collection
public class Comment{
@OneToMany(cascade=CascadeType.ALL, orphanRemoval=false, mappedBy="post", fetch=FetchType.LAZY)
@LazyCollection(LazyCollectionOption.EXTRA)
@Where(clause="blocked=0")
@OrderColumn(name="idx")
public List<Comment> getComments() {
return comments;
}
and you call
getComments().size()
the resulting SQL is
select max(idx) + 1 from Comment where FK_PostId =?
as opposed to
select max(idx) + 1 from Comment where FK_PostId =? and blocked=0
It's an edge case but it is incorrect
|