Then Elkanah, her husband, said to her: "Anna, why do you weep?" etc. Ten sons symbolize the receivers or observers of the law's decalogue. Therefore, the Lord consoles the Church, so that it does not bear grievously that the legislation, the promises, the covenant, and the entrusted utterances of God were given not to it but to the Synagogue; but let it be cheered and exult with the greatest joy, that it has now deserved to receive a greater gift and better grace than all these, the advent of the Mediator of God and men, the man Jesus Christ, whom it did not know to expect or hope for. This l...esson not only figuratively expresses the different states of the two peoples, but also the differing merits of the dissenting persons in each of those peoples, and the different rewards of merits. For Christ has always loved, and will love, the humble tears of penitents more than the rigid justice of the proud; and, neglecting the Pharisee's arrogance, who exalts himself as if fertile with the progeny of ten sons due to his fulfillment of legal commands, he deigns rather to regard the lamentations of the penitent publican.
Source: Commentary on Samuel