Talmud, Ta'anit 23b
The Talmud (Ta'anis 23b) relates an interesting incident about the sage Choni HaM'agel (who once prayed for rain during a drought and refused to move from within a circle until the rain came - which it did). " R' Yochanan said: This righteous man [Choni] was throughout his whole life troubled about the meaning of the verse (Psalms 126), A Song of Ascents, When Hashem will return the captivity of Zion, we will be like dreamers.' Is it possible for a man to dream continuously for seventy years? One day he was journeying on the road and he saw a man planting a carob tree; he asked him, How long does it take [for this tree] to bear fruit? The man replied: Seventy years. He then further asked him: Are you certain that you will live another seventy years? The man replied: I found [ready grown] carob trees in the world; as my forefathers planted these for me so I too plant these for my children.
Choni sat down to have a meal and sleep overcame him. As he slept a rocky formation enclosed upon him which hid him from sight and he continued to sleep for seventy years. When he awoke he saw a man gathering the fruit of the carob tree and he asked him, Are you the man who planted the tree? The man replied: I am his grandson. Thereupon he exclaimed: It is clear that I slept for seventy years."
INTERPRETATION
Choni then came across the man planting the carob tree. Choni saw an individual toiling, engaged in a task which did not produce immediate results nor satisfaction. The tree would not bear fruit for seventy years, at which time the planter would not be around to enjoy the literal fruits of his labor. Choni saw that although a tree could appear to be valueless and insignificant for such an extended period of time, it, in the long run, had value and was productive. Choni realized that people may toil and labor throughout their entire lives. This time may be like a dream, fleeting and insignificant for what results occur during that time period. However, upon arriving at the next world, the World To Come, we can reap our reward and realize how productive our lives were.
Furthermore, although a tree may not give direct benefit to the individual that planted it, the individual's children, his successors, will enjoy the product of his effort. When a person toils in This World, by following the dictates of G-d and His commandments, the person is not merely placing himself in a situation where he is deserving of reward, whether it come in this world or the next. He is also directly benefiting his children. He is setting forth a lesson. As the planter said "As my forefathers' planted for me, so too I plant for my children." He is directing his children's path for the future. He is establishing benefit for his children. Hashem rewards the children of those that love Him as well. Choni vividly saw this lesson, as when he woke up after 70 years, he saw the grandchild of the planter eating the fruits of his grandfather's labor. Clearly, the toil in a short and fleeting life, seemingly insignificant, could be nothing farther from that.