JPA Code completion only partially working for a @Query

已回答

In a Spring Boot 2 wth JPA project I have a custom query defined with @Query on top of a function definition in a custom method of a JpaRepository:

public interface MyRepo extends JpaRepository<MyEntity, Long> {

@Query(value = "SELECT myEntity.data " +
" FROM AnotherEntity another, MyEntity myEntity " +
" WHERE myEntity.id = :id AND another.code ='XY' AND myEntity.anotherId = another.id")
byte[] getData(@Param("id") Long id);

}

In this case I have the completion and navigation on MyEntity and AnotherEntity is greyed and has not completion or navigation:

Now if I declare the interface like this JpaRepository<AnotherEntity, Long>, it is the contrary. 

Is there a way to have the code completion for all the entities used in queries of a given JpaRepository ?

In addition any refactoring done on the Entity class name is reflected on the entity for which there is code completion, but not the refactoring on fields name.

0

Make sure you have data source assigned to the persistence usin, see Associating persistence units and session factories with data sources and both entities are mapped to database tables.

f issue remains, please provide a sample to check.

0

请先登录再写评论。