Does something like below will work for you? If not why?
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import java.util.List;
public interface TestVersionRepository extends JpaRepository<TestVersion, Long> {
@Query("SELECT tv FROM TestVersion tv " +
"WHERE tv.version = (SELECT max(tv2.version) FROM TestVersion tv2 " +
"WHERE tv2.identification = tv.identification) " +
"ORDER BY tv.identification, tv.majorVersion DESC, tv.minorVersion DESC, tv.patchVersion DESC")
List<TestVersion> findLatestVersions();
}