  A doubly heavy baryon can be regarded as composed of a heavy diquark and a
light quark. In this picture, we study the masses of the doubly heavy diquarkes
in the Bethe-Salpeter (BS) formalism first, which are then used as one of the
inputs in studying the masses of the doubly heavy baryons in the quark-diquark
model. We establish the BS equations for both the heavy diquarks and the heavy
baryons with and without taking the heavy quark limit, respectively. These
equations are solved numerically with the kernel containing the scalar
confinement and one-gluon-exchange terms. The mass of the doubly charmed baryon
$\Xi_{cc}^{(\ast)}$ is obtained in both approaches, $3.60\sim3.65\,\rm GeV$
($\Xi_{cc}^{(\ast)}$) under the heavy quark limit, $3.53\sim3.56\,\rm GeV$ for
$\Xi_{cc}$ and $3.61\sim3.63\,\rm GeV$ for $\Xi_{cc}^\ast$ without taking the
heavy quark limit. The masses of $\Xi_{bc}^\prime$, $\Xi_{bc}^{(\ast)}$,
$\Xi_{bb}^{(\ast)}$, $\Omega_{cc}^{(\ast)}$, $\Omega_{bc}^\prime$,
$\Omega_{bc}^{(\ast)}$ and $\Omega_{bb}^{(\ast)}$ are also predicted in the
same way. We find that the corrections to the results in the heavy quark limit
are about $-0.02\,\rm GeV\sim-0.11\,\rm GeV$ for the masses of the doubly heavy
baryons.
