Spin and orbital ordering in ternary transition metal oxides