A hydraulic cylinder comprising: an elongate body defining an internal cavity that extends along a longitudinal axis of the elongate body ; a pair of end caps at opposite ends of the elongate body ; a piston and rod assembly at least partially in the internal cavity , the piston and rod assembly being movable in a direction of the longitudinal axis ; a position sensor and a sensor rod in the internal cavity , the sensor rod extending along the longitudinal axis ; and a sensor retainer assembly in the internal cavity , the sensor retainer assembly being coaxial with the sensor rod and adapted to retain the sensor rod at the longitudinal axis , the sensor retainer assembly including: an annular body defining a bore extending from opposite ends of the annular body , the bore being adapted to receive the sensor rod such that the sensor rod extends from the opposite ends of the annular body , a magnet ring disposed in the bore at an inner wall of the annular body , the magnet ring being radially outward of the sensor rod , and one or more magnets fixedly disposed between the annular body and the magnet ring in a radial direction of the annular body , the one or more magnets being radially outward of the sensor rod , wherein each of the one or more magnets is fixedly molded between the annular body and the magnet ring . an elongate body defining an internal cavity that extends along a longitudinal axis of the elongate body ; a pair of end caps at opposite ends of the elongate body ; a piston and rod assembly at least partially in the internal cavity , the piston and rod assembly being movable in a direction of the longitudinal axis ; a position sensor and a sensor rod in the internal cavity , the sensor rod extending along the longitudinal axis ; and a sensor retainer assembly in the internal cavity , the sensor retainer assembly being coaxial with the sensor rod and adapted to retain the sensor rod at the longitudinal axis , the sensor retainer assembly including: an annular body defining a bore extending from opposite ends of the annular body , the bore being adapted to receive the sensor rod such that the sensor rod extends from the opposite ends of the annular body , a magnet ring disposed in the bore at an inner wall of the annular body , the magnet ring being radially outward of the sensor rod , and one or more magnets fixedly disposed between the annular body and the magnet ring in a radial direction of the annular body , the one or more magnets being radially outward of the sensor rod , wherein each of the one or more magnets is fixedly molded between the annular body and the magnet ring . an annular body defining a bore extending from opposite ends of the annular body , the bore being adapted to receive the sensor rod such that the sensor rod extends from the opposite ends of the annular body , a magnet ring disposed in the bore at an inner wall of the annular body , the magnet ring being radially outward of the sensor rod , and one or more magnets fixedly disposed between the annular body and the magnet ring in a radial direction of the annular body , the one or more magnets being radially outward of the sensor rod , wherein each of the one or more magnets is fixedly molded between the annular body and the magnet ring . <EOS>