Last active
October 19, 2017 05:52
-
-
Save antygravity/ae7c0f11bc87537ec77e96d1824c5659 to your computer and use it in GitHub Desktop.
Android Room sample DAO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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