I Upgraded Project to SpringBoot Version 2.2.0.RELEASE to 2.7.4.This is the example Repository Interface.
import com.flyaero.aeromasterapiservice.data.AddLanguageRequest;
import org.springframework.data.couchbase.core.query.N1qlPrimaryIndexed;
import org.springframework.data.couchbase.core.query.Query;
import org.springframework.data.couchbase.repository.CouchbasePagingAndSortingRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
@Repository
@N1qlPrimaryIndexed
public interface LanguageRepository extends CouchbasePagingAndSortingRepository<AddLanguageRequest, String> {
Optional<AddLanguageRequest> findById(String id);
AddLanguageRequest save(AddLanguageRequest entity);
@Query("#{#n1ql.selectEntity} WHERE modelName = 'AddLanguageRequest' AND #{#n1ql.filter}")
List<AddLanguageRequest> findAll();
}
After Change the SpringBoot version to 2.7.4 cannot use CouchbasePagingAndSortingRepository.We can use only CouchbaseRepository. Problem is @Query is not supporting.
import com.flyaero.aeromasterapiservice.data.AddLanguageRequest;
import org.springframework.data.couchbase.core.query.N1qlPrimaryIndexed;
import org.springframework.data.couchbase.core.query.Query;
//import org.springframework.data.couchbase.repository.CouchbasePagingAndSortingRepository;
import org.springframework.data.couchbase.repository.CouchbaseRepository;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
@Repository
@N1qlPrimaryIndexed
public interface LanguageRepository extends CouchbaseRepository<AddLanguageRequest, String> {
Optional<AddLanguageRequest> findById(String id);
AddLanguageRequest save(AddLanguageRequest entity);
@Query("#{#n1ql.selectEntity} WHERE modelName = 'AddLanguageRequest' AND #{#n1ql.filter}")
List<AddLanguageRequest> findAll();
}
What would be the best possible options?
Repositories & Queries
org.springframework.data.couchbase.core.query.Query became org.springframework.data.couchbase.repository.Query
More details available in latest Spring Data Couchbase - Reference Documentation https://docs.spring.io/spring-data/couchbase/docs/current/reference/html/#couchbase.repository.multibucket