Buggy code:
@ Repository public class CollectionRepositoryHibernate extends BaseRepositoryHibernate implements ConstantProperties , ParameterProperties , CollectionRepository { private static final String PAGE_SIZE = "pageSize" ; private static final String PAGE_NO = "pageNum" ; private static final String COLLECTION_ITEM_BY_RESOURCE = "FROM<seq2seq4repair_space>CollectionItem<seq2seq4repair_space>collectionItem<seq2seq4repair_space>WHERE<seq2seq4repair_space>collectionItem.resource.gooruOid=:resourceId" ; private static final String COLLECTION_ITEM_BY_SEQUENCE = "FROM<seq2seq4repair_space>CollectionItem<seq2seq4repair_space>collectionItem<seq2seq4repair_space>WHERE<seq2seq4repair_space>collectionItem.collection.gooruOid=:collectionId<seq2seq4repair_space>and<seq2seq4repair_space>collectionItem.itemSequence>:itemSequence<seq2seq4repair_space>order<seq2seq4repair_space>by<seq2seq4repair_space>collectionItem.itemSequence<seq2seq4repair_space>asc" ; private static final String GET_COLLECTION_BY_RESOURCE_OID = "Select<seq2seq4repair_space>distinct(collectionItem.collection)<seq2seq4repair_space>FROM<seq2seq4repair_space>CollectionItem<seq2seq4repair_space>collectionItem<seq2seq4repair_space>where<seq2seq4repair_space>collectionItem.resource.gooruOid=:resourceId" ; private static final String GET_COLLECTION_ITEM_BY_RESOURCE_OID = "FROM<seq2seq4repair_space>CollectionItem<seq2seq4repair_space>collectionItem<seq2seq4repair_space>WHERE<seq2seq4repair_space>collectionItem.collection.gooruOid=:collectionId<seq2seq4repair_space>and<seq2seq4repair_space>collectionItem.resource.gooruOid=:resourceId<seq2seq4repair_space>and<seq2seq4repair_space>" + ( generateOrgAuthQuery ( "collectionItem.collection." ) ) ; @ SuppressWarnings ( "unchecked" ) @ Override public List < Collection > getCollections ( Map < String , String > filters , User user ) { } @ SuppressWarnings ( "unchecked" ) @ Override public List < Classpage > getClasspage ( Map < String , String > filters , User user ) { } @ SuppressWarnings ( "unchecked" ) @ Override public List < CollectionItem > getCollectionItems ( String collectionId , Map < String , String > filters ) { } @ Override public Collection getCollectionByGooruOid ( String gooruOid , String gooruUid ) { } @ Override public Collection getCollectionByIdWithType ( String gooruOid , String type ) { } @ Override public Classpage getClasspageByGooruOid ( String gooruOid , String gooruUid ) { } @ Override public Classpage getClasspageByCode ( String classpageCode ) { } @ SuppressWarnings ( "unchecked" ) @ Override public Collection getUserShelfByGooruUid ( String gooruUid , String type ) { } @ SuppressWarnings ( "unchecked" ) @ Override public Classpage getUserShelfByClasspageGooruUid ( String gooruUid , String type ) { } @ SuppressWarnings ( "unchecked" ) @ Override public CollectionItem getCollectionItemById ( String collectionItemId ) { } @ SuppressWarnings ( "unchecked" ) @ Override <START_BUG> public List < Collection > getCollectionsByResourceId ( String resourceGooruOid ) { <END_BUG> Query query = getSession ( ) . createQuery ( ( "Select<seq2seq4repair_space>collection<seq2seq4repair_space>FROM<seq2seq4repair_space>CollectionItem<seq2seq4repair_space>collectionItem<seq2seq4repair_space>WHERE<seq2seq4repair_space>collectionItem.resource.gooruOid=:resourceGooruOid<seq2seq4repair_space>and<seq2seq4repair_space>" + ( generateOrgAuthQuery ( "collectionItem.collection." ) ) ) ) ; query . setParameter ( "resourceGooruOid" , resourceGooruOid ) ; addOrgAuthParameters ( query ) ; return query . list ( ) ; } @ SuppressWarnings ( "unchecked" ) @ Override public List < CollectionItem > getCollectionItemByAssociation ( String resourceGooruOid , String gooruUid , String type ) { } @ Override public List < CollectionItem > getCollectionItemByParentId ( String collectionGooruOid , String gooruUid , String type ) { } @ SuppressWarnings ( "unchecked" ) @ Override public List < String > getCollectionGooruOidsByResourceId ( long contentId ) { } @ Override public Assignment getAssignmentByGooruOid ( String gooruOid , String gooruUid ) { } @ Override public Assignment getAssignmentUserShelfByGooruUid ( String gooruUid , String type ) { } @ SuppressWarnings ( "unchecked" ) @ Override public List < Assignment > getAssignments ( Map < String , String > filters , User user ) { } @ SuppressWarnings ( "unchecked" ) @ Override public List < Collection > getMyCollection ( Map < String , String > filters , User user ) { } @ SuppressWarnings ( "unchecked" ) @ Override public List < Collection > getMyCollection ( String offset , String limit , String type , String filter , User user ) { } @ Override public Quiz getQuiz ( String gooruOid , String gooruUid , String type ) { } @ SuppressWarnings ( "unchecked" ) @ Override public List < Quiz > getQuizList ( String gooruOid , String gooruUid , String type ) { } @ SuppressWarnings ( "unchecked" ) @ Override public List < Quiz > getQuizzes ( Integer limit , Integer offset ) { } @ SuppressWarnings ( "unchecked" ) @ Override public List < Quiz > getMyQuizzes ( Integer limit , Integer offset , String gooruUid , String orderBy ) { } @ SuppressWarnings ( "unchecked" ) @ Override public List < CollectionItem > getCollectionItemByResourceId ( Long resourceId ) { } @ SuppressWarnings ( "unchecked" ) @ Override public List < Classpage > getMyClasspage ( Integer offset , Integer limit , User user , boolean skipPagination , String orderBy ) { } @ SuppressWarnings ( "unchecked" ) @ Override public List < Collection > getMyCollection ( Integer limit , Integer offset , String orderBy , String fetchType , String filterName , User user ) { } @ SuppressWarnings ( "unchecked" ) @ Override public List < CollectionItem > getMyCollectionItems ( Map < String , String > filters , User user ) { } @ SuppressWarnings ( "unchecked" ) @ Override public List < CollectionItem > getCollectionItems ( String collectionId , Integer offset , Integer limit , String orderBy , String type ) { } @ Override public Long getCollectionItemsCount ( String collectionId , String orderBy , String type ) { } @ SuppressWarnings ( "unchecked" ) @ Override public Resource findResourceCopiedFrom ( String gooruOid , String gooruUid ) { } @ SuppressWarnings ( "unchecked" ) @ Override public List < Classpage > getClasspages ( Integer offset , Integer limit , String title , String author , String userName ) { } @ Override public Long getClasspageCount ( String gooruOid , String itemType ) { } @ Override public Long getClasspageCollectionCount ( String classpageGooruOid , String status , String userUid , String orderBy , String type ) { } @ Override public Long getClasspageCount ( String title , String author , String userName ) { } @ Override public Long getMyClasspageCount ( String gooruUid ) { } @ SuppressWarnings ( "unchecked" ) @ Override public List < Object [ ] > getMyFolder ( String gooruUid , Integer limit , Integer offset , String sharing , String collectionType , boolean fetchChildItem , String orderBy , String excludeType ) { } @ SuppressWarnings ( "unchecked" ) @ Override public List < Object [ ] > getCollectionItem ( String gooruOid , Integer limit , Integer offset , String sharing , String orderBy , String collectionType , boolean fetchChildItem , String sequenceOrder , boolean fecthAll , String excludeType ) { } @ Override public Long getMyShelfCount ( String gooruUid , String sharing , String collectionType , String excludeType ) { } @ Override public Long getCollectionItemCount ( String gooruOid , String sharing , String collectionType , String excludeType ) { }

Fix:
public List < Collection > getCollectionsByResourceId ( final String resourceGooruOid ) {