The Giants acquired Hernandez and right-hander Miguel Mendez (undisclosed) from the Padres on Monday in exchange for left-hander Robbie Ray, Alex Pavlovic of NBC Sports Bay Area reports.

A 17-year-old shortstop from Cuba, Hernandez signed with the Padres for $1.4 million back in January. Hernandez has excelled at the plate during his time in the Dominican Summer League this season, slashing .303/.424/.503 with four home runs and four stolen bases over 41 games.