Claims reserving models are usually based on data recorded in run-off tables, according to the origin and the development years of the payments. The amounts on the same diagonal are paid in the same calendar year and are influenced by some common effects, for example, claims inflation, that can induce dependence among payments. We introduce hierarchical generalized linear models (HGLM) with risk parameters related to the origin and the calendar years, in order to model the dependence among payments of both the same origin year and the same calendar year. Besides the random effects, the linear predictor also includes fixed effects. All the parameters are estimated within the model by the h-likelihood approach. The prediction for the outstanding claims and an approximate formula to evaluate the mean square error of prediction are obtained. Moreover, a parametric bootstrap procedure is delineated to get an estimate of the predictive distribution of the outstanding claims. A Poisson-gamma HGLM with origin and calendar year effects is studied extensively and a numerical example is provided. We find that the estimates of the correlations can be significant for payments in the same calendar year and that the inclusion of calendar effects can determine a remarkable impact on the prediction uncertainty.