private E fetchObject ( ) { try { String previousSkip = "&skip=" + ( skipCounter - 1 ) ; String currentSkip = "&skip=" + skipCounter ; int indexOf = q . indexOf ( previousSkip ) ; if ( indexOf > 0 ) { q . replace ( indexOf , indexOf + previousSkip . length ( ) , currentSkip ) ; } else if ( skipCounter > 0 ) { q . append ( currentSkip ) ; } client . executeQueryAndGetResults ( q , _id , m , results , interpreter ) ; skipCounter ++ ; } catch ( Exception e ) { logger . error ( "Error while executing query, caused by {}." , e ) ; throw new KunderaException ( "Error while executing query, caused by : " + e ) ; } if ( results != null && ! results . isEmpty ( ) ) { Object object = results . get ( 0 ) ; results = new ArrayList ( ) ; if ( ! m . isRelationViaJoinTable ( ) && ( m . getRelationNames ( ) == null || ( m . getRelationNames ( ) . isEmpty ( ) ) ) ) { return ( E ) object ; } else { return setRelationEntities ( object , client , m ) ; } } return null ; }
Fetch object .