Disclaimer: This is not a homework problem. I stumbled on this puzzle on internet and I also have the answer. However I am not able to figure out whats the method to be used to arrive at the answer.

The puzzle is as below:

The product of the ages of David's children is the square of the sum of their ages. David has less than eight children. None of his children have the same age. None of his children is more than 14 years old. All of his children is at least two years old. How many children does David have, and what are their ages?

The answer happens to be 2,4,6,12.

Please suggest ways to solve this problem systematically.