I am trying to use the @Query to create a custom method in my jpa repository but I am getting the following error at runtime, please help me check it out. Thanks in advance
below is the code
public interface OrganizationRepository extends JpaRepository<Organization, Long> { List<Organization> findByDeleted(Boolean isDeleted); List<Organization> findAllByDeletedOrderById(Boolean isDeleted); @Query(value="SELECT * FROM ORGANIZATION WHERE id = :organizationId AND NAME LIKE %:organizationId% LIMIT 1 ", nativeQuery = true) Organization findFirstNameByNameLike(@Param("organizationId") Long organizationId, @Param("name") String name); } below is the runtime error
Caused by: java.lang.IllegalStateException: Using named parameters for method public abstract com.oasis.firsbacklogbackend.entity.Organization com.oasis.firsbacklogbackend.repository.OrganizationRepository.findFirstNameByNameLike(java.lang.Long,java.lang.String) but parameter 'Optional[name]' not found in annotated query 'SELECT * FROM ORGANIZATION WHERE id = :organizationId AND NAME LIKE %:organizationId% LIMIT 1 '! I would appreciate any help