In this paper we study the simultaneous optimization of berth allocation and quay crane assignment in seaport container terminals. We propose a model based on an exponential number of variables that is solved via column generation. An exact branch-and-price algorithm is implemented to produce optimal integer solutions to the problem. In particular, we present several accelerating techniques for the master and the pricing problem that can be generalized to other branch-and-price schemes. Computational results show that the proposed approach outperforms commercial solvers. Furthermore, the developed algorithm allows for a comparative analysis between the hierarchical and the integrated solution approach that confirms the added value of integration in terms of cost reduction and efficient use of resources. To the best of our knowledge, this is the first exact branch-and-price algorithm for both the berth allocation problem and the berth allocation problem with quay crane assignment.