Skip to content

Instantly share code, notes, and snippets.

@antygravity
Last active October 19, 2017 05:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antygravity/ae7c0f11bc87537ec77e96d1824c5659 to your computer and use it in GitHub Desktop.
Save antygravity/ae7c0f11bc87537ec77e96d1824c5659 to your computer and use it in GitHub Desktop.
Android Room sample DAO
@Dao
public interface AddressDao {
@Query("SELECT * FROM address")
List<Address> getAll();
@Query("SELECT * FROM address WHERE id IN (:addressIds)")
List<Address> loadAllByIds(int[] addressIds);
@Query("SELECT * FROM address WHERE city LIKE :city AND "
+ "street LIKE :street LIMIT 1")
Address findByCityAndStreet(String city, String street);
@Insert
void insert(Address address);
@Delete
void delete(Address address);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment