In-memory store: a criteria block on a to-one association mapped under another key matches nothing

オープン 初心者向け
#17,112 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
74/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
groovy
領域
databases

調査の方向性

まず SimpleMapQuery.queryAssociation を読んでください。issue では、criteria ブロックがマップされたキーではなくプロパティ名で association を読んでいると述べられています。記述されている grails-datamapping-core-test spec で失敗を再現してください: owner が 1 人いて、その holder の名前は h1 で、holder key: 'stored_holder' としてマップされ、['o1'] を期待するが [] になる、というものです。完了とは、association criteria がマップされたキーを解決し、新しい spec が unmapped-association workaround なしで通ることを意味します。

索引モデルが issue の本文から書いたものです。

説明

On the in-memory datastore, ProbeOwner.createCriteria().list { holder { eq('name', 'h1') } } returns an empty list when the association is mapped as static mapping = { holder key: 'stored_holder' }. The block reads the stored map under the property name (holder) instead of the mapped key (stored_holder) in SimpleMapQuery.queryAssociation, so any criterion inside the block misses.

Found on plain 7.0.x (d0ae54a6c6) with a spec in grails-datamapping-core-test: one owner with holder named h1, result [], expected ['o1']. No isEmpty involved. Found while reviewing #17009.

Workaround: leave the association unmapped (no key:) on the in-memory store.

主要言語
Groovy
スター
2.9k
フォーク
980
平均マージ
1日 21時間
マージ済み PR(30日)
148

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

apache/grails-core のほかの issue

apache/grails-core の issue をすべて見る

似ている issue

Databases の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。