Is it a good idea to buy second hand bike model that has been discontinued?
Generally it's absolutely fine to buy a relatively new bike, and not worry about component availability.

Bicycles are not like cars that have specific components for each model, or at best some component sharing across a manufacturers models. In general, practically all bicycle components are standardized so that bicycles can be built up (or modified) with components from many manufacturers. 

There is an increasing trend for some manufacturers to integrate the seatpost, stem and sometimes handlebars of some models into the frame design for aerodynamics or to facilitate internal cable routing, but the Orbea model you mentioned does not have this.