We investigate the pairwise entanglement and global entanglement in a generalized Jaynes-Cummings model,which can be used to realize Greenberger-Horne-Zeilinger (GHZ) entangled state (Zheng S B 2001 Phys. Rev. Lett. 87230404). Our results show that the W-type entangled states cannot be generated based on the model. The dependences of entanglement on Rabi frequency λ and dipole-dipole coupling strength Ω are given. It is found that there exists the quantum phase transition when λ = Ω. For typical experimental data, the critical temperature for pairwise entanglement is on the order of 10-6 K. Based on these results, two strategies that overcome decoherence are proposed.