Luke101
Luke101

Reputation: 65238

How to pass parameters to spring data repository

Consider this code:

    public interface AppRepository extends MongoRepository<App, String> {
    List<App> findAppsByUserAndIsDraft(String user, false);
}

I need to find all records by username and IsDraft. As you can see I am passing a false for IsDraft. This does not work as spring gives this error identifyer or type expected. Is there a way around this?

Upvotes: 0

Views: 630

Answers (1)

Vipul Pandey
Vipul Pandey

Reputation: 1738

List findAppsByUserAndIsDraft(String user, false); change your method to List findAppsByUserAndIsDraftFalse(String user);

Upvotes: 1

Related Questions