Fixed object incorrect sorting on database model when generating code.