For the Greater Good
אין דור שאין בו ליצנים. מה היו פריצי הדור עושין? היו הולכין אצל חלונותיו של דוד ואומרים לו “דוד אימת יבנה בית המקדש? אימתי בית ה’ נלך?” והוא אומר אע”פ שמתכונין להכעיסני יבא עלי שאני שמח בלבי – “שמחתי באומרים לי בית ה’ נלך” (תהילים קכ:א). (ברכות ב:א יג,א)
Every generation sees itself as inferior to previous ones. But the Rabbis teach us that there is no generation that does not have its share of scorners. The people of the generations of the Rabbis clearly held on to the notion that David’s era was superior to theirs. Even a generation under the rule of the righteous king David had within it a significant bad element.
The scorners would walk by David’s windows and mockingly ask: “When will the Temple be built? When will we go to the House of God”. Knowing God’s decree that it will not be David but his son Solomon who would build the Temple this was tantamount to saying: “David, when will you die already?”. Although the scorners’ intentions were to anger David they did have a genuine interest in the building of the Temple.
But David’s love for the Temple was so immense that the scorners’ actions achieved the opposite effect. David was happy at the thought that people were awaiting the building of the Temple even though in effect it meant his death. For the greater good David was even willing to give up his life!
The Talmud Bavli has a similar teaching surrounding the Torah study of David:
“שיר המעלות לדוד שמחתי באומרים לי בית ה’ נלך”. אמר דוד לפני הקדוש ברוך הוא רבש”ע שמעתי בני אדם שהיו אומרים מתי ימות זקן זה ויבא שלמה בנו ויבנה בית הבחירה ונעלה לרגל ושמחתי “אמר לו הקב”ה: “כי טוב יום בחצריך מאלף” (תהלים פד:יא) טוב לי יום אחד שאתה עוסק בתורה לפני מאלף עולות שעתיד שלמה בנך להקריב לפני על גבי המזבח: (מכות י.)
In essence David tells God that he sees his life as valueless in the face of the building of the Temple, but God sees things from a very different perspective. David, on the contrary is more valuable to God than the Temple because his Torah study is more weighty than the sacrifices which the Temple will facilitate.
The apparent goal of this formulation of the teaching is to show Torah study as more significant than Temple sacrifice and to pin this position in antiquity.