If you have an ulcer of hernia in your stomach would that cause you to gain weight?

No. If you have ulcers in your stomach due to a hiatal hernia, you may need to have it surgically repaired by a general or thoracic surgeon experienced in laparoscopic hiatal hernia repair.
Unclear. It is not clear what you mean by an "ulcer of hernia in your stomach". People with peptic ulcer disease tend to lose weight, as their symptoms are exacerbated by meals.