Abstract : We study the two-dimensional joint distribution of the first hitting time of a constant level by a continuous-state branching process with immigration and their primitive stopped at this time. We show an explicit expression of its Laplace transform. Using this formula, we study the polarity of zero and provide a necessary and sufficient criterion for transience or recurrence. We follow the approach of Shiga, T. (1990) [A recurrence criterion for Markov processes of Ornstein-Uhlenbeck type. Probability Theory and Related Fields, 85(4), 425-447], by finding some $\lambda$-invariant functions for the generator.