Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Modifing not supported by vavr integration #26190

Closed
jbochard opened this issue Dec 1, 2020 · 2 comments
Closed

@Modifing not supported by vavr integration #26190

jbochard opened this issue Dec 1, 2020 · 2 comments
Labels
for: external-project Needs a fix in external project status: invalid An issue that we don't feel is valid

Comments

@jbochard
Copy link

jbochard commented Dec 1, 2020

I'm working with spring-boot 2.3.5.RELEASE and vavr 0.10.3 and I have this error when I try to invoke the method disableEnabledCredentials() defined in this way:

public interface ICredentialDAO extends Repository<Credential, String> {

    @Modifying
    @Query("update Credential d set d.enabled = false where d.enabled = true")
    Try<Integer> disableEnabledCredentials();

    Option<Credential> findByEnabled(boolean enabled);

    Try<Credential> save(Credential credential);

}

Error: "Modifying queries can only use void or int/Integer as return type!"; nested exception is java.lang.IllegalArgumentException: Modifying queries can only use void or int/Integer as return type!

I know that vavr is supported by spring-data-jpa because I has using this features in other methods as findByEnabled() or save().

The support by vavr should't include @Modifying allowing return of Try or Try?

My pom includes:

<properties>
    <spring-boot-dependencies.version>2.3.5.RELEASE</spring-boot-dependencies.version>
</properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-dependencies</artifactId>
                <version>${spring-boot-dependencies.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-undertow</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>io.vavr</groupId>
            <artifactId>vavr</artifactId>
            <version>0.10.3</version>
        </dependency>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Dec 1, 2020
@bclozel
Copy link
Member

bclozel commented Dec 3, 2020

Spring Framework provides some support around Vavr's Try (see #20361) but the problem you're seeing is probably related to Spring Data Commons' support. This was added in DATACMNS-983, but I haven't found any mention of @Modifying nor know enough about this subject to help here.

Could you create a new issue in the Spring Data Commons project please?

Thanks!

@bclozel bclozel closed this as completed Dec 3, 2020
@bclozel bclozel added for: external-project Needs a fix in external project status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Dec 3, 2020
@jbochard
Copy link
Author

jbochard commented Dec 5, 2020

JIRA created: DATACMNS-1840

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project Needs a fix in external project status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants