Perhaps I was being a little harsh, but I believe it is up to us as Pilots to work with companies, to ensure both our needs and theirs are met.
We as Pilots, need to get experience to get another foot up the greasy pole and they need stability in their Pilot groups.
If they ask for 2 years, and you agree, then you should be held accountable to their cost of training you. If you leave prior to the agreed term - you should compensate them. If you are not prepared to do this, you should not accept the job and 'free' training the company will provide you. You should buy your own endorsement and be a free agent instead (and we all know how I feel about this).
GG