Buggy code:
@ Entity @ Configurable public class ChecklistItem { @ PersistenceContext ( unitName = "persistenceUnit" ) transient EntityManager entityManager ; @ NotNull @ Size ( max = 5000 ) private String name ; @ Size ( max = 5000 ) private String description ; @ NotNull @ Enumerated private ItemType itemType ; @ Enumerated private OptionType optionType ; private Boolean isRegressionItem ; private Integer sequenceNumber ; @ ManyToOne private CheckList checkList ; @ ManyToOne private ChecklistItem parentItem ; private Double weight ; @ OneToMany ( cascade = CascadeType . ALL , mappedBy = "checklistItem" ) @ OrderBy ( "sequenceNumber" ) private List < ChecklistOption > checkListOptions = new ArrayList < ChecklistOption > ( ) ; @ OneToMany ( cascade = CascadeType . ALL , mappedBy = "checklistItem" ) @ OrderBy ( "sequenceNumber" ) private List < ChecklistCriteria > checkListCriterias = new ArrayList < ChecklistCriteria > ( ) ; @ OneToMany ( cascade = CascadeType . ALL , mappedBy = "parentItem" ) @ OrderBy ( "sequenceNumber" ) private List < ChecklistItem > childChecklistItems = new ArrayList < ChecklistItem > ( ) ; @ OneToMany ( cascade = CascadeType . ALL , mappedBy = "checklistItem" ) private List < ItemAnalysis > itemAnalysis = new ArrayList < ItemAnalysis > ( ) ; @ OneToMany ( cascade = CascadeType . ALL , mappedBy = "checklistItem" ) private List < PostAnalysis > postAnalysis = new ArrayList < PostAnalysis > ( ) ; public static List < ChecklistItem > findChecklistTopicByChecklistId ( Long checklistId ) { } public static List < ChecklistItem > findChecklistQuestionByChecklistTopicId ( Long checklistTopicId ) { } public static List < ChecklistItem > findAllChecklistItemsForChecklist ( Long checklistId ) { } public static List < ChecklistItem > findAllChecklistItemsChild ( Long parentId ) { } public static List < ChecklistItem > findAllChecklistItemByChecklistId ( Long checklistId ) { } public static ChecklistItem saveChecklistTabItem ( String name , String description , Long standardizedRoleId ) { } public static Integer findMaxTabSequenceNumber ( Long checklistId ) { } public static Boolean removeChecklistTabItem ( Long checklistItemId ) { } @ Transactional private Boolean removeChecklistTab ( ) { } public static ChecklistItem saveChecklistTopicItem ( String name , String description , Long parentTabItemId , Double weight ) { } public static Boolean removeChecklistTopicItem ( Long checklistItemId ) { } @ Transactional private Boolean removeChecklistTopic ( ) { } public static ChecklistItem saveChecklistQuestionItem ( String name , String description , Boolean isOverallQue , OptionType optionType , Long parentTopicItemId ) { } public static Boolean removeChecklistItemQuestionItem ( Long checklistItemId ) { } @ Transactional private void removeChecklistQuestion ( ) { } public static Integer findMaxSequenceNumberByParentItem ( Long parentItemId ) { } public static List < ChecklistItem > findChecklistItemByParentId ( Long parentId ) { } public static List < ChecklistItem > findChecklistItemByChecklistId ( Long checklistId ) { } public static List < ChecklistItem > findChecklistTopicByChecklist ( Long checklistId ) { } public static List < ChecklistItem > findChecklistQuestionByChecklistTopic ( Long checklistTopicId ) { } private static void exportChecklistItemsChild ( List < ChecklistItem > checklistItems , List < ChecklistItem > questionList ) { } public static List < ChecklistItem > findChecklistQuestionByChecklistId ( Long checklistId ) { } public static List < OscePostWiseQuestion > findChecklistQuestionByOscePost ( Long osceSequenceId ) { } public static List < ChecklistItem > findChecklistTopicByChecklistTab ( Long checklistTabId ) { List < ChecklistItem > topicList = new ArrayList < ChecklistItem > ( ) ; EntityManager em = ChecklistItem . entityManager ( ) ; <START_BUG> String sql = ( ( ( "SELECT<seq2seq4repair_space>ci<seq2seq4repair_space>FROM<seq2seq4repair_space>ChecklistItem<seq2seq4repair_space>ci<seq2seq4repair_space>WHERE<seq2seq4repair_space>ci.parentItem<seq2seq4repair_space>=" + checklistTabId ) + "<seq2seq4repair_space>and<seq2seq4repair_space>ci.itemType=" ) + ( TOPIC . ordinal ( ) ) ) + ")<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>ci.sequenceNumber" ; <END_BUG> TypedQuery < ChecklistItem > query = em . createQuery ( sql , ChecklistItem . class ) ; topicList . addAll ( query . getResultList ( ) ) ; return topicList ; } public static List < ChecklistItem > findAllChecklistTabsByChecklistId ( Long checkistId ) { } public static boolean checkCriteriaForRemoveChecklistQuestionItem ( ChecklistItem checklistItem ) { } public static List < ChecklistImportPojo > findAllChecklistTabsByRoles ( Long checklistId ) { } public static List < ChecklistItem > importChecklistTabsForTab ( Long currentRoleId , Long selectedRoleId , Long checklistTabId ) { } public ChecklistItem copyChecklistTabItemFromOld ( ChecklistItem oldChecklistItem , Integer seqNumber , CheckList newChecklist ) { } @ Transactional public void copyChecklistItemFromAnotherItem ( ChecklistItem newChecklistItem , ChecklistItem oldChecklistItem ) { } @ Transactional public static ChecklistItem copyChecklistItem ( ChecklistItem oldChecklistItem , ChecklistItem newItem ) { } @ Transactional public static void copyOptions ( ChecklistItem newChecklistItem , ChecklistItem oldChecklistItem ) { } @ Transactional public static void copyCriterias ( ChecklistItem newChecklistItem , ChecklistItem oldChecklistItem ) { } public static List < ChecklistItem > importChecklistTopicsForRole ( Long currentRoleId , Long selectedRoleId , Long topicId , Long tabId ) { } private ChecklistItem copyChecklistTopicItemFromOld ( ChecklistItem oldChecklistItem , Integer seqNumber , ChecklistItem currentTab ) { } public static List < ChecklistImportPojo > findAllChecklistTopicsByRoles ( Long checklistId ) { } public static List < ChecklistItem > findAllChecklistTopicsByChecklist ( Long checklistId ) { } public static void importChecklistQuestionsForTopic ( Long selectedtopicId , Long selectedRoleId , Long questionId , Long currentTopicId ) { } public static List < ChecklistItem > findChecklistItemQuestionById ( List < Long > itemIdList ) { } @ Transactional private void copyChecklistQuestionItemFromOld ( ChecklistItem questionItem , Integer seqNumber , ChecklistItem currentTopic ) { } public static List < ChecklistImportPojo > findChecklistQuestionByTopicId ( Long topicId ) { } public static Double findMaxTopicWeight ( Long checklistId ) { } public static CheckList copyOldChecklist ( Long oldChecklist , String title ) { } public static ChecklistItem moveChecklistItemUp ( ChecklistItem checklistItemToMoveUp , int seqNumToSet ) { } public static ChecklistItem moveChecklistItemDown ( ChecklistItem checklistItemToMoveDown , int seqNumToSet ) { } @ Transactional public ChecklistItem moveItemDown ( ChecklistItem checklistItemToMoveDown , int seqNumToSet ) { } @ Transactional public ChecklistItem moveItemUp ( ChecklistItem checklistItemToMoveUp , int seqNumToSet ) { } public static List < ChecklistItem > updateChecklistItemQuestionSequenceNumber ( List < Long > checklistItemIdList ) { } @ Transactional public void updateChecklistItemQueSequenceNumber ( List < Long > checklistItemIdList ) { }

Fix:
String sql = ( ( ( "SELECT<seq2seq4repair_space>ci<seq2seq4repair_space>FROM<seq2seq4repair_space>ChecklistItem<seq2seq4repair_space>ci<seq2seq4repair_space>WHERE<seq2seq4repair_space>ci.parentItem<seq2seq4repair_space>=<seq2seq4repair_space>" + checklistTabId ) + "<seq2seq4repair_space>and<seq2seq4repair_space>ci.itemType<seq2seq4repair_space>=<seq2seq4repair_space>" ) + ( TOPIC . ordinal ( ) ) ) + "<seq2seq4repair_space>ORDER<seq2seq4repair_space>BY<seq2seq4repair_space>ci.sequenceNumber" ;