Fix NamedQuery generation