1
findAllByPropertyInList()의 이상한 결과가 있고 이것은 grails의 버그입니다. [1]을 참조하십시오. 결과는 내가 기대하는 바가 아니며 이고 다른 쿼리는 무엇을 말하고 있습니다. 어떤 종류의 JOIN이 결과를 날려 버릴 수 있습니까? max-property가 실행 된 후 DISTINCT가 결과의 의 수를 다시 줄입니까?findAllByPropertyInList 결과가 잘못되었거나 JOIN 관련 또는 최대 절전 모드로 구분/페이징 문제가 발생 했습니까?
또는 이것은 Hibernate가 DISTINCT와 페이지 매김 프라 티티를 하나의 쿼리에서 사용할 수 없다는 것과 관련이 있습니까?
들으 세바스찬
[1]
def criteria = Foo.createCriteria()
def results = criteria.listDistinct() {
...
}
results.id.unique().size()
==>34
results.topic.unique().size() // some of the topics are duplicate
==>25
def more = Foo.findAll([max:20, offset:0]).size()
==>20
def more = Foo.getAll(results.id).size()
==>34
def more = Foo.findAllByTopicInList(results.topic, [max:20, offset:0]).size()
==> 7 // expected 25
def more = Foo.findAllByIdInList(results.id, [max:20, offset:0]).size()
==> 7 // expected 34
class Foo {
String topic
SubCategory subCategory
List<Article> articles
WritingStyle writingStyle
SortedSet<Keyword> keywords = []as SortedSet
SortedSet<String> linkTexts = []as SortedSet
ArticleType articleType = ArticleType.FreestyleArticle
static belongsTo = [project: Project]
static hasMany = [articles:Article, keywords: Keyword, linkTexts: String]
static constraints = {
topic(blank: false, size: 1..200)
subCategory(nullable: false)
writingStyle(nullable: true)
articles nullable:true
}
static mapping = {
writingStyle fetch: 'join'
subCategory fetch: 'join'
keywords cascade: 'all-delete-orphan'
keywords fetch: 'join'
linkTexts cascade: 'all-delete-orphan'
}
}
max param을 설정했기 때문에 마지막 두 결과가 20 일 것으로 기대합니다. 최대 값이 없으면 두 경우 모두 34를 기대합니다. – user852518
아마도 도메인 모델에 연관이 있습니다. 푸를 보여줄 수 있어요? 나는 당신이 게으르지 않고 열망하는 사람들을 '가져 오기'로 정의했다고 생각합니다. 결과적으로 협회 당 하나의 결과 항목이 생깁니다. – Chris
@ user852518 맞아요. 그래도 결과가 없습니다. – skurt