When a solid dissolves in water, the process always has a energy change associated with it.
Examples exist for both endothermic and exothermic heats of solution.
However, the dissolving process itself is really a two-step process. The first step, that of breaking down the solid crystal, is endothermic while the second step, that of hydrating the individual particles released into the solvent, is exothermic. For an ionic compound, ionic bonds are broken while ion-dipole forces are formed. Ion-dipole forces are formed when the slightly positive hydrogen atoms are attracted to the negative ions, and the slightly negative oxygen atoms are attracted to the positive ions. The overall heat of solution depends on the relative amounts of energy involved in the two individual steps.