A compressor includes a sensor configured to detect a position of a piston; a sensor core configured to reciprocate within the sensor and with the piston; and a core supporting member configured to support the sensor core. The core supporting member is injection molded into the core supporting member, and the sensor core is insert molded into the core supporting member.