1

I want to check if I have a given parameter value in my Room database using Java. If it is there then I just update the record, otherwise I insert a new one. How can I get this done?

FlightDAO

@Query("SELECT EXISTS (SELECT * FROM flight_table WHERE (flightNumber = :flightNumber and date = :date))")
public boolean existsFlight(String flightNumber, String date);

Repository

public boolean existsFlight(String flightNumber, String date){
        return (WHAT DO I RETURN?);
    }
Ian Bell
  • 533
  • 5
  • 18

0 Answers0