A device to be implanted and assembled in a patient, the device comprising: at least one locking part comprising in a distal region a liquefiable material capable of being liquefied by mechanical vibration, and a pre-assembly of a plurality of device parts in which pre-assembly the device parts are connected to each other but pairs of selected ones of the device parts are still moveable relative to each other, or providing a plurality of device parts equipped for such pre-assembly, wherein of pairs of device parts being moveable relative to each other in the pre-assembly each device part comprises a second joining location comprising a non-liquefiable material and a structure which is suitable to form a positive fit connection with the liquefiable material of the locking part, the two second joining locations being arranged on the device parts of the pair to face each other and a space between the two second joining locations being accessible for the locking part, the device to be assembled and implanted using a method. comprising the steps of: providing the at least one locking part, providing the pre-assembly or providing the plurality of device parts equipped for such pre-assembly, the space between the two second joining locations being accessible for the locking part to be brought in contact with one of the pair of device parts, positioning the pre-assembly in an implantation site or pre-assemble the device parts in the implantation site to form the pre-assembly, bringing the pre-assembly into a site-specific configuration by moving the selected ones of the device parts relative to each other, and bringing the distal end of the locking part into the space between the two second joining locations pressing the distal end of the locking art against one of the pair of device parts and applying mechanical vibration to the locking part or one of the device parts for a time sufficient for liquefying enough of liquefiable material and press it between the two second joining locations to lock the site-specific configuration of the two device parts. at least one locking part comprising in a distal region a liquefiable material capable of being liquefied by mechanical vibration, and a pre-assembly of a plurality of device parts in which pre-assembly the device parts are connected to each other but pairs of selected ones of the device parts are still moveable relative to each other, or providing a plurality of device parts equipped for such pre-assembly, comprising the steps of: providing the at least one locking part, providing the pre-assembly or providing the plurality of device parts equipped for such pre-assembly, the space between the two second joining locations being accessible for the locking part to be brought in contact with one of the pair of device parts, positioning the pre-assembly in an implantation site or pre-assemble the device parts in the implantation site to form the pre-assembly, bringing the pre-assembly into a site-specific configuration by moving the selected ones of the device parts relative to each other, and bringing the distal end of the locking part into the space between the two second joining locations pressing the distal end of the locking art against one of the pair of device parts and applying mechanical vibration to the locking part or one of the device parts for a time sufficient for liquefying enough of liquefiable material and press it between the two second joining locations to lock the site-specific configuration of the two device parts.