2

This is one of error getting class,

import com.bookingsite.acme.config.document.paymentoption.PaymentGatewayConfiguration;
import com.bookingsite.acme.config.dto.paymentgatewaysearchrequest.PaymentGatewayConfigSearchRequestDTO;
import com.bookingsite.acme.config.dto.paymentgatewaysearchrequest.PaymentOptionsDTO;
import com.couchbase.client.java.query.dsl.Sort;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

@Getter
@Setter
public class PaymentGatewaySearchData {

    private String searchQuery;
    private Sort sort;
    private int offset;
    private int limit;
    private int totalCount;

    private List<PaymentGatewayConfiguration> paymentGatewaySearchResponseList;

    private PaymentGatewayConfigSearchRequestDTO paymentGatewayConfigSearchRequestDTO;

    private List<PaymentOptionsDTO> paymentOptions;

}

I Upgraded Spring boot version to 2.7.4 and currently we using Couchbase to SDK3 version.After that getting this error.

other used methords

public Sort getOrderByQuery(
            PaymentTemplateConfigSearchFilterRequestDTO paymentTemplateConfigSearchFilterRequestDTO) {

        if (validateOrderBy(paymentTemplateConfigSearchFilterRequestDTO)) {
            if (paymentTemplateConfigSearchFilterRequestDTO.getSortDirection().equals(SortDirectionDTO.DESCENDING)) {
                return Sort.desc(paymentTemplateConfigSearchFilterRequestDTO.getSortBy().getAction());
            } else {
                return Sort.asc(paymentTemplateConfigSearchFilterRequestDTO.getSortBy().getAction());
            }

        } else {

            return Sort.desc(N1QlQueryConstants.TEMPLATEMODIFIEDDATE);

        }

    }

What would be the best possible options?

gimhanas
  • 69
  • 5

2 Answers2

2

I imagine the compiler is complaining that com.couchbase.client.java.query.dsl.Sort does not exist.

This Couchbase Forum post explains why the classes in com.couchbase.client.java.query.dsl from SDK 2 were not carried forward to SDK 3.

If you wish to continue using the DSL classes, the recommendation is to copy the relevant source code from SDK 2 into your project.

UPDATE: There's now a GitHub repo with the "missing" experimental Query DSL classes from SDK 2, adapted for SDK 3. Now it really should be as simple as copying these classes into your project: https://github.com/couchbaselabs/couchbase-java-sdk2-migration-kit

dnault
  • 8,340
  • 1
  • 34
  • 53
  • Thank you very much for reply.This will helpful a lot.Can you explain where should I integrate the specified couchbase dsl changes to should it be integrated in to my code base?Could you please explain.Thanks in advanced. – gimhanas Oct 21 '22 at 07:00
  • 1
    Step 1: Clone the [SDK 2 repository](https://github.com/couchbase/couchbase-java-client). Step 2: Create package `com.couchbase.client.java.query.dsl.` in your own project. Step 3: Find that package in the SDK 2 source code, and copy all of the files to the corresponding location in your project. Step 4: Compile your project, and and fix any compilation issues you discover. – dnault Oct 21 '22 at 15:58
  • If your company has an enterprise subscription license and you need additional help, consider reaching out to Couchbase Technical Support or Professional Services. – dnault Oct 21 '22 at 16:00
  • 1
    Where can I find these dependencies used in many of the DSL folders? I cannot find these files in the Git repository provided about import com.couchbase.client.core.annotations.InterfaceAudience; import com.couchbase.client.core.annotations.InterfaceStability; These files are found in the Couchbase JVM core repository. How can we use it in the above scenario? Is it not available in Couchbase sdk3? https://github.com/couchbase/couchbase-jvm-core/tree/master/src/main/java/com/couchbase/client/core/annotations – gimhanas Oct 24 '22 at 13:18
  • 1
    These imports are also used in the DSL package. But could not locate them in the repositories. import com.couchbase.client.deps.io.netty.util.internal.StringUtil; import com.couchbase.client.deps.com.fasterxml.jackson.core.io.JsonStringEncoder; – gimhanas Oct 24 '22 at 13:22
  • 1
    You can remove all references to those annotations. They're just for documenting whether something is part of the SDK's public API. – dnault Oct 24 '22 at 21:25
  • 1
    For `StringUtil.isNullOrEmpty`, you can replace it with this: `public static boolean isNullOrEmpty(String s) { return s == null || s.isEmpty(); }` – dnault Oct 24 '22 at 21:25
  • 1
    For `JsonStringEncoder`, remove the `com.couchbase.client.deps.` prefix from the package name, and add Jackson to your project: https://central.sonatype.dev/artifact/com.fasterxml.jackson.core/jackson-core/2.13.4 – dnault Oct 24 '22 at 21:27
  • 1
    dnault your com.couchbase.client.java.query.dsl. fixing steps are worked properly. Now I faced an issue with project test case coverage. Do you have any idea to fix it? Can we have import com.couchbase.client.java.query.dsl. with Gradle dependencies or convert it to lib or jar? – gimhanas Nov 28 '22 at 06:46
  • 1
    @gimhanas There are no plans to publish the DSL classes as a JAR. You could exclude the package from your test coverage results, or add the test cases from the [couchbase-java-sdk2-migration-kit](https://github.com/couchbaselabs/couchbase-java-sdk2-migration-kit) GitHub repo to your project. – dnault Nov 28 '22 at 17:22
0

QueryDSL is back in spring-data-couchbase.

Can you please open an issue for this? https://github.com/spring-projects/spring-data-couchbase/issues

Michael Reiche
  • 375
  • 1
  • 7
  • The user is looking for a couchbase implementation of querydsl. I pointed to one. – Michael Reiche Dec 16 '22 at 20:47
  • "then why do you ask for creating an issue?" In case they care to provide more information than "After that getting this error." There are three of of us from couchbase (Matthew Groves, dnault and myself) trying to help this user. And all we have to go on is "After getting this error". – Michael Reiche Dec 22 '22 at 18:32
  • "If you do not contribute anything but a link, then this is a link-only answer" Oh please. I told them that QueryDSL is in spring-data-couchbase (which they are apparently already using based on the code they provided). If you don't understand what QueryDSL is, or the significance of it being in spring-data-couchbase when that was what the user was looking for I cannot help you. I might know a thing or two about QueryDSL in spring-data-couchbase. I wrote it. https://github.com/spring-projects/spring-data-couchbase/issues/1288 – Michael Reiche Dec 22 '22 at 18:33
  • If "QueryDSL is back in spring-data-couchbase." is what you consider your contributed solution, then OK. I propose to focus the answer post on that and use a comment to ask OP to create an issue or to provide sufficient debugging info here. You (I assume one of your team has sufficient reputation) can also close vote the question for lack of debugging details. – Yunnosch Dec 22 '22 at 18:36
  • That is the right way to tell a question author that the question does not contain enough information for helping them. The fact that the question gets closed if some people agree with you and then no additional answers are possible puts a little strength into that. The question author is then motivated to rework the question and add the needed details. This is different from "threaten to have their post removed". It is only removed if it gets closed and then downvoted and then delete-voted. Which usually does not happen if OP does indeed add info. – Yunnosch Dec 22 '22 at 19:56
  • Is it not possible to provide a solution for the presumed problem AND solicit further information? – Michael Reiche Dec 22 '22 at 22:34
  • It is. Provide the solution in an answer post and ask for the ticket or more info in a comment. If you think that the question is not answerable without the info you are asking for, then vote to close it. – Yunnosch Dec 22 '22 at 22:37