For query molecules it is possible to define the number of Hydrogen atoms needed to have in the target structure. Either define it explicitly by adding the Hydrogen atoms to the specified atoms or implicitly by setting implicit hydrogen count. If the implicit hydrogen count is specified then it is stored in the atom and not calculated from the valence any more.
Code Example:
define query implicit hydrogen count
atom.setQProp("h", 2);
define query explicit hydrogen count
atom.setQProp("H", 2);