We use the Cellular Potts Model (CPM) to study the contact angle (CA) hysteresis in multiphase (solid-liquid-vapour) systems. We simulate a droplet over the tilted patterned surface, and a bubble placed under the surface immersed in liquid. The difference between bubbles and droplets was discussed through their CA hysteresis. Dependency of CA hysteresis on the surface structure and other parameters was also investigated. This analysis allows decoupling of the 1D (pinning of the triple line) and 2D (adhesion hysteresis in the contact area) effects and provides new insight into the nature of CA hysteresis.