Created
November 2, 2018 14:49
-
-
Save MwBakker/2e6791aa8807c5b014dedd0d1cb1217f to your computer and use it in GitHub Desktop.
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
package com.mwb.digitalstorage.database; | |
import com.mwb.digitalstorage.model.Shelf; | |
import com.mwb.digitalstorage.model.Storage; | |
import androidx.lifecycle.LiveData; | |
import androidx.room.Dao; | |
import androidx.room.Insert; | |
import androidx.room.Query; | |
import java.util.List; | |
@Dao | |
public interface DAO extends Storable { | |
@Override | |
void store(); | |
@Insert | |
void insertStorage(Storage storage); | |
@Insert | |
void insertShelf(Shelf shelf); | |
@Query("DELETE FROM storage_table") | |
void deleteAll(); | |
@Query("SELECT * from storage_table ORDER BY storage_name ASC") | |
LiveData<List<Storage>> getAllStorages(); | |
@Query("SELECT shelf_id, shelf_name, shelf_location from shelf_table " + | |
"INNER JOIN storage_table " + | |
"WHERE storage_table.storage_id == storage_id ORDER BY shelf_name ASC") | |
LiveData<List<Storage>> getAllShefls(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment