Spring Tool Suite
  1. Spring Tool Suite
  2. STS-3050 improve tooling support for Spring Data
  3. STS-2888

Allow change the error level of "Invalid derived Query!" for spring data

    Details

    • Type: Sub-task Sub-task
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.0.RELEASE
    • Fix Version/s: 3.2.0.M2
    • Component/s: DATA
    • Labels:
      None

      Description

      The methods of repository may not follow the standard of Spring data if custom factory is used to override the function of Spring Data JPA repository. It is allow to do so, but STS will show the "Invalid derived Query!" Error annotation next to those method.

      It is better to allow us to choose the error level of the "Invalid derived Query!"

      http://forum.springsource.org/showthread.php?129458-STS-3-0-0-Spring-Data-support-can-i-change-error-level-of-Invalid-derived-Query!

        Activity

        Hide
        Tomasz Zarna added a comment -

        Excuse my ignorance, but isn't it an EclipseLink/JPA bug (not STS)? If I got it right the error level should be configurable at Java Persistance > JPA > Errors/Warnings pref page.

        If that's not the case, a tip on how to make the error show up would be highly appreciated. Step by step please, I'm a newbie

        Show
        Tomasz Zarna added a comment - Excuse my ignorance, but isn't it an EclipseLink/JPA bug (not STS)? If I got it right the error level should be configurable at Java Persistance > JPA > Errors/Warnings pref page. If that's not the case, a tip on how to make the error show up would be highly appreciated. Step by step please, I'm a newbie
        Hide
        Martin Lippert (c) added a comment -

        This validation is done by the Spring IDE support for Spring Data. Oliver Gierke knows more about this.

        Show
        Martin Lippert (c) added a comment - This validation is done by the Spring IDE support for Spring Data. Oliver Gierke knows more about this.
        Hide
        Tomasz Zarna added a comment -

        Guys (especially Ka, the reporter) could you give me a step-by-step instruction how to see the error?

        Show
        Tomasz Zarna added a comment - Guys (especially Ka, the reporter) could you give me a step-by-step instruction how to see the error?
        Hide
        Ka Ming added a comment -

        Sample:
        http://static.springsource.org/spring-data/data-jpa/docs/current/reference/html/#repositories.custom-behaviour-for-all-repositories

        I think STS will assume all the interface with extends Repository MUST following the rules of spring data.
        i.e. if there is a interface like this:
        public interface MyRepository<T, ID extends Serializable> extends JpaRepository<T, ID>

        { void sharedCustomMethod(ID id); }

        There is an error marker on the sharedCustomMethod method.

        However we can override the behavior of the repository like:
        <repositories base-package="com.acme.repository" factory-class="com.acme.MyRepositoryFactoryBean" />

        Show
        Ka Ming added a comment - Sample: http://static.springsource.org/spring-data/data-jpa/docs/current/reference/html/#repositories.custom-behaviour-for-all-repositories I think STS will assume all the interface with extends Repository MUST following the rules of spring data. i.e. if there is a interface like this: public interface MyRepository<T, ID extends Serializable> extends JpaRepository<T, ID> { void sharedCustomMethod(ID id); } There is an error marker on the sharedCustomMethod method. However we can override the behavior of the repository like: <repositories base-package="com.acme.repository" factory-class="com.acme.MyRepositoryFactoryBean" />
        Hide
        Tomasz Zarna added a comment -

        Thx Ka, got it now. From what I can see the error is shown only in an editor, the Problems view seems to know nothing about it.

        Now I wonder where the option for changing the error level should be? Creating a separate Errors/Warnings page under Spring just for one pref doesn't make much sense. Is one of the Validators/Builders tabs a better place for it? I noticed that some of the validator rules can have their severity configured.

        Show
        Tomasz Zarna added a comment - Thx Ka, got it now. From what I can see the error is shown only in an editor, the Problems view seems to know nothing about it. Now I wonder where the option for changing the error level should be? Creating a separate Errors/Warnings page under Spring just for one pref doesn't make much sense. Is one of the Validators/Builders tabs a better place for it? I noticed that some of the validator rules can have their severity configured.
        Hide
        Tomasz Zarna added a comment -

        Pushed a quick-and-dirty fix to github here. The patch allows to choose between "Error" and "Warning" severities for the problem. I guess what I would need to add in the final version are options for "Info" and "Ignore", correct me if I'm wrong. As for the UI I decided to add a third tab on the "Spring" pref page. The tab is titled "Project Problems" and for now contains a single item i.e. "Invalid Derived Query". I wouldn't get to attach to it as the UI is going to drastically change soon anyway, see STS-3021. Just let me know if this is how you would see it and I will polish the patch.

        Show
        Tomasz Zarna added a comment - Pushed a quick-and-dirty fix to github here . The patch allows to choose between "Error" and "Warning" severities for the problem. I guess what I would need to add in the final version are options for "Info" and "Ignore", correct me if I'm wrong. As for the UI I decided to add a third tab on the "Spring" pref page. The tab is titled "Project Problems" and for now contains a single item i.e. "Invalid Derived Query". I wouldn't get to attach to it as the UI is going to drastically change soon anyway, see STS-3021 . Just let me know if this is how you would see it and I will polish the patch.
        Hide
        Tomasz Zarna added a comment -

        The pref page with the new tab.

        Show
        Tomasz Zarna added a comment - The pref page with the new tab.
        Hide
        Tomasz Zarna added a comment -

        Fixed in 9c6d1d5cc9119d0bb121e75034d8f36bb4babdd2.

        The severity can be now configured on the Spring pref page. "Invalid derived query" rule can be found under "Data Validator".

        Show
        Tomasz Zarna added a comment - Fixed in 9c6d1d5cc9119d0bb121e75034d8f36bb4babdd2 . The severity can be now configured on the Spring pref page. "Invalid derived query" rule can be found under "Data Validator".
        Hide
        Tomasz Zarna added a comment - - edited

        Follow up issues: STS-3114, STS-3115 and STS-3118.

        Show
        Tomasz Zarna added a comment - - edited Follow up issues: STS-3114 , STS-3115 and STS-3118 .

          People

          • Assignee:
            Tomasz Zarna
            Reporter:
            Ka Ming
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              First Response Date: