Okay this might be a stupid question, but couldn't find any clear explanation on the internet, so here goes.

If I factor a polynomial into products of irreducible polynomials, are the products of these irreducible polynomials then again an irreducible polynomial?

For clarification, here is the problem im working on:

*Let $J$ be the ideal of $\mathbb{Q}[x]$ generated by two polynomials: $f(x)=(x+1)(x+2)(x^2 +1)$ $\textit{and}$ $g(x)=(x+1)^2 (x+2)^2.$ Is the ideal $J$ prime? Is it maximal? Is it principal?*

Clearly the common factors of $f$ and $g$ are $(x+1)(x+2)$, but would it be right to say that $p(x)=(x+1)(x+2)$ is an irreducible polynomial over $\mathbb{Q}$?

If this is the right approach, I think I can handle the rest of the problem myself.

Thanks in advance :)