AlexFalappa / nb-springboot

NetBeans IDE plugin supporting programming with Spring Boot

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Please add completion/suggestion for creating repo methods

Chris2011 opened this issue · comments

In this improvements list: https://blog.jetbrains.com/idea/2017/03/spring-data-improvements-in-intellij-idea-2017-1/ if you scroll down a bit to the Smarter Code Completion section, you can see, that they suggest keywords to create repo methods for the mapped SQL, what Spring does in the background. This is very handy, if you didn't create your repo method before, but if you want to create it ad hoc.

Cheers

Chris

@Chris2011 this is a very complex feature so I will likely not have time to implement it.
Hope someone will step up and help.

Yeah, I thought so too. Thx for the info. Hope too, that someone can catch up.

I'm just thinking we can get ideas from JPA's @NamedQuery completion to achieve this feat.

It seems that it just check the properties of the object and can chain them together with And or other operators: https://docs.spring.io/spring-data/commons/docs/current/reference/html/#repositories.query-methods.query-property-expressions

I already had a look into the functionality how this works. A colleague of mine helped me understanding it. It seems that it is working as mentioned before somehow. You have a model and inside the repository class it goes through your model based on the generic type that you aligned as T and the IDE goes through your Pojo and adds some basic keywords, your propertyname and operators to it. Here is a little example to test it out.

demochris.zip

Maybe that makes it easier to implement such functionality into the code completion.