I have reviewed the examples that are close to what I am trying to solve. But they use such odd or complex naming conventions I am cross eyed in reviewing and re-reviewing them. So I am trying here. I've looked for example at the following:
- https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#repositories
- https://www.petrikainulainen.net/programming/spring-framework/spring-data-jpa-tutorial-introduction-to-query-methods/
- How To Define a JPA Repository Query with a Join
So the basics of my SQL Tables are: owner table - ID - owner_name ownerproperty table - ID - address - owner_id
So when the user logins I grab their "owner_name". I pass that to my Service but need to do a join/lookup for the owner ID as that is what is in the ownerproperty table(I didn't set this up). The point is I need to grab the user's properties from teh ownerproperty table as they could have many listed in there.
I am extending JpaRepository and in there I have custom query that begins with @Query("select id from owner where owner_name: myParam") MyCommunities findByOwnerId(@Param("myParam" String myParam);
I assuming that this means that "myParam" is the user's name that I get and pass through. ANd that is put in the @Query and the value returned is what is passed to findByOwnerId. From what I understand JPA/Spring/Hibernate does its magic and queries owernproperties table through the Entity I have set up as "owner" has a getter/setter in the Entity and it is a field in the table.
but I cannot compile as it flag the @Query line with "start of illegal type". I've tried researching this and cannot find what I'm doing wrong.
I have imported jpa.repository.Query, repository.query.Param, util.Optional, and repository.Repository.