You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The IDE compiler have a lot of wrong problem report, maven build is okay #1159
The IDE compiler wrongly reporting problem for several scenario.
Complaining about JpaRepository using composite key. When using composite key in JPA class, extending JpaRepository interface will report error "Expected Domain ID type is 'java.lang.Long", but it only complaining on some class, some other class using same composite key will have no problem.
I'm using org.json.JSONObject, the IDE already reference to the spring-starter org.json package and keep complaining that the toMap() function is not available from class.
Can you attach a sample project that reproduces these wrong problem reporting? That would be awesome.
With regards to 1., this clearly sounds like an issue with the Spring specific validation that we should fix.
With regards to 2., this sounds like a project setup or dependency resolution issue, the sample project would be interesting to analyze here.
Which IDE are you using? The Eclipse based Spring Tools or working inside of VSCode?
@yiukalun any chance you can paste here a code snippet for something that has a problem marker that reads: Expected Domain ID type is 'java.lang.Long'?
2. I'm using org.json.JSONObject, the IDE already reference to the spring-starter org.json package and keep complaining that the toMap() function is not available from class.
@yiukalun If you still face this issue and if you can create a small sample project for this, please create a separate issue for this and attach the sample project. Happy to look into this.
It might be right in forcing to switch the repo key to Inetger to match the domain class id but as I mentioned earlier I'm far from spring data expert. Thus, I left them a question asking whether the marker is correct in this case. If it is not correct I'm curious what would be the rule for this case... both classes have corresponding primitive types if one primitive type can be cast to another perhaps is the rule (?)
Activity
martinlippert commentedon Dec 13, 2023
Can you attach a sample project that reproduces these wrong problem reporting? That would be awesome.
With regards to 1., this clearly sounds like an issue with the Spring specific validation that we should fix.
With regards to 2., this sounds like a project setup or dependency resolution issue, the sample project would be interesting to analyze here.
Which IDE are you using? The Eclipse based Spring Tools or working inside of VSCode?
BoykoAlex commentedon Dec 13, 2023
@yiukalun any chance you can paste here a code snippet for something that has a problem marker that reads:
Expected Domain ID type is 'java.lang.Long'?yiukalun commentedon Dec 14, 2023
BoykoAlex commentedon Dec 14, 2023
@yiukalun I have pushed what i think would the fix for the composite repo key: de4a132
Please try to update your sts from a nightly update site starting from ~2 hours from now. See https://cdn.spring.io/spring-tools/snapshot/STS4/nightly-distributions.html for snapshot distros and update sites
martinlippert commentedon Dec 15, 2023
@yiukalun If you still face this issue and if you can create a small sample project for this, please create a separate issue for this and attach the sample project. Happy to look into this.
BoykoAlex commentedon Dec 19, 2023
@yiukalun should be fixed. Please re-open if you still see issues around composite key. (The fix is de4a132
raneem13j commentedon Dec 21, 2023
I have the same problem, I am using VS code, and in another repo it works
`package com.Dazzle.app.Dazzle.repositories;
import java.util.Optional;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.Dazzle.app.Dazzle.models.user.ERole;
import com.Dazzle.app.Dazzle.models.user.Role;
@repository
public interface RoleRepository extends JpaRepository<Role, Long> {
Optional findByName(ERole name);
}
`
`package com.Dazzle.app.Dazzle.models.user;
import jakarta.persistence.*;
@entity
@table(name = "roles")
public class Role {
}
`
BoykoAlex commentedon Dec 22, 2023
@raneem13j I'm not an expert in Spring Data :-\ I've trimmed your use case to the one below which I hope is showing the same issue:
and the domain class:
It might be right in forcing to switch the repo key to
Inetgerto match the domain class id but as I mentioned earlier I'm far from spring data expert. Thus, I left them a question asking whether the marker is correct in this case. If it is not correct I'm curious what would be the rule for this case... both classes have corresponding primitive types if one primitive type can be cast to another perhaps is the rule (?)BoykoAlex commentedon Dec 22, 2023
@raneem13j Fixed with 1665b3f