At first it seemed both counter-intuitive and somewhat paradoxical but I received some insanely good advice from a mentor midway through my career that I think applies to your situation as well...
Basically, the key to success for any job, whether you hate it and want to move elsewhere soon or love it and want a promotion and to continue contributing to team in a greater capacity is
...wait for it...
To begin almost immediately to start making for the exit. I don't mean that literally, of course. The core of the idea is that if you want to leave because you hate it, you need to make it as painless as possible for everyone. That usually means documenting the hell out of everything you work on so that it is trivial for anyone to come behind you and pick up your responsibilities. This is made much simpler if your firm has a centralized knowledge base, but the tools shouldn't really matter - Google Docs or Word are fine.
When I say everything, I mean EVERYTHING - Daily, Weekly, Monthly, Quarterly responsibilities should be explained at a high level then thoroughly documented in as much detail as you can physically muster in a day. Code that you check in should be documented extensively as well: from inline comments to function signatures with examples of usage to class diagrams if your employer is into those things (and maybe even if they're not).
The goal is to have made it so that you are actually leaving them better off than they were before because they probably never had that level of process and activity documentation before. If you provide more value than they paid you for, then at least you can feel ok about your decision. At the end of the day, it's a job - they pay you and you do work, and if you give back more value than they compensate you for, the time you spend there is irrelevant.
On the other hand, if you WANT to stay then you need to be thinking about how you can progress in your career development and still not impact the team and Manager to whom you'll start off reporting. I've been on both sides of this one and it's tough to have to make a decision about whether or not you can afford to lose a solid employee who contributes to your team's objectives.
I have never personally had to prohibit an employee from making a requested change but on a few occasions I have had to work with them on the timing of a move due to fiscal considerations or perhaps other organizational issues. Keep in mind some places have regular freezes where headcount is locked at a level on a certain date and if you leave before that date your Manager may wind up down a Full Time Employee on their team permanently or for an extended period time.
Nonetheless, the strategy in this scenario is mostly the same as above - make yourself replaceable. If your knowledge is capture in your comments, documentation, and knowledge base articles then a less-skilled or equally skilled co-worker can pick up where you left off and your Manager will have less objection to your departure. In this case, I'd suggest going a few steps further and being pro-active in finding an ideal replacement candidate who you think shows promise and offering to be their mentor.
Not only does this demonstrate leadership skills but it shows that you're not solely focused on your own career advancement and is something that any good Manager will recognize as a value to your organization. Even if you don't have a good Manager, though, even a bad Manager will recognize that you've worked out a way for your departure to have as least of an impact on the team as possible, and as I mention above you may even actually leave the team better off if you leave more knowledge documented than existed before you arrived.