# ReactiveNeo4jRepository: No property found for type

**URL:** <https://community.neo4j.com/t/reactiveneo4jrepository-no-property-found-for-type/54543>\
**Category:** Spring Data Neo4j & Neo4j-OGM\
**Created:** [April 7, 2022, 3:42pm UTC](https://community.neo4j.com/t/reactiveneo4jrepository-no-property-found-for-type/54543 "2022-04-07T15:42:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris3](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/chris3/32/24147_2.png) [@chris3](https://community.neo4j.com/u/chris3)\
**Post date:** [April 7, 2022, 3:42pm UTC](https://community.neo4j.com/t/reactiveneo4jrepository-no-property-found-for-type/54543/1 "2022-04-07T15:42:49Z")

</div>

I am thinking about giving SDN a go again, trying out Interface-based Projections:

```auto
interface UserSDNRepository : ReactiveNeo4jRepository<UserSDN, Long> {
  fun findAllUsernames(): Flux<UsernameOnly>
}

interface UsernameOnly {
	val username: String?
}

```

and also tried a Java interface like

```auto
public interface UsernameOnly{
	String getUsername();
}

```

but as soon as Spring Boot starts up I get:

```auto
...
Caused by: org.springframework.data.mapping.PropertyReferenceException:
No property 'findAllUsernames' found for type 'UserSDN'!
...

```

I have tried different names for the findAll function.  
BTW I also have a `fun findByUsername(username: String): Mono<SimpleUser> ` where SimpleUser is a class based projection and that works fine.

What am I missing here? I think according to the docs at [Spring Data Neo4j](https://docs.spring.io/spring-data/neo4j/docs/current/reference/html/#projections.interfaces) that should work. Is it not possible with Reactive repositories? Or is it a Kotlin issue?

Cheers, Chris

---

<div class="post-metadata">

**Author:** ![gerrit.meier](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/gerrit.meier/32/27374_2.png) [@gerrit.meier](https://community.neo4j.com/u/gerrit.meier)\
**Post date:** [April 12, 2022, 7:01am UTC](https://community.neo4j.com/t/reactiveneo4jrepository-no-property-found-for-type/54543/2 "2022-04-12T07:01:25Z")

</div>

This is not a problem with projections but the query method you are defining.  
The `fun findByUsername(username: String): Mono<SimpleUser>` works because you are looking for the `username` field in the entity `UserSDN`.  
The other query method defines a `findAll_Usernames_`. This will make SDN look into `UserSDN` for the property `usernames` (plural). The error message gives the hint that it cannot find this particular property.  
Back to your use-case:  
If you do not want to use the property, you could write `fun findAllProjectedBy(): Flux<UsernameOnly>`.  
What you could also do, is to write a generic projection method like this:

```auto
fun <T> findAllProjectedBy(projectionClass: Class<T>): List<T>

```

This would allow you to use different projection if needed.

---

<div class="post-metadata">

**Author:** ![chris3](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/chris3/32/24147_2.png) [@chris3](https://community.neo4j.com/u/chris3)\
**Post date:** [April 15, 2022, 8:33pm UTC](https://community.neo4j.com/t/reactiveneo4jrepository-no-property-found-for-type/54543/3 "2022-04-15T20:33:18Z")

</div>

Thanks for the reply, Gerrit!
