Why did Frederick the Great and Maria Theresa go to war twice? Was it because Frederick the great disliked her, or because he was protecting Prussia?

Why did Frederick the Great and Maria Theresa go to war twice? Was it because Frederick the great disliked her, or because he was protecting Prussia?