From bed4186bc3117bd9a4044739730537e873bbe235 Mon Sep 17 00:00:00 2001 From: jacques Date: Mon, 7 Mar 2022 22:08:21 +0100 Subject: [PATCH] use correct import --- ...icDatabase.java => PilldroidDatabase.java} | 6 +-- .../net/foucry/pilldroid/dao/MedicDAO.java | 54 ++++++++++--------- 2 files changed, 32 insertions(+), 28 deletions(-) rename app/src/main/java/net/foucry/pilldroid/{MedicDatabase.java => PilldroidDatabase.java} (62%) diff --git a/app/src/main/java/net/foucry/pilldroid/MedicDatabase.java b/app/src/main/java/net/foucry/pilldroid/PilldroidDatabase.java similarity index 62% rename from app/src/main/java/net/foucry/pilldroid/MedicDatabase.java rename to app/src/main/java/net/foucry/pilldroid/PilldroidDatabase.java index 2aaf85c..9ba304a 100644 --- a/app/src/main/java/net/foucry/pilldroid/MedicDatabase.java +++ b/app/src/main/java/net/foucry/pilldroid/PilldroidDatabase.java @@ -1,10 +1,10 @@ package net.foucry.pilldroid; -import android.arch.persistence.root.Database; -import android.arch.persistence.root.RoomDatabase; +import androidx.room.Database; +import androidx.room.RoomDatabase; import net.foucry.pilldroid.dao.MedicDAO; -import net.foucry.pilldroid.model.Medic; +import net.foucry.pilldroid.models.Medic; @Database(entities = {Medic.class}, version = 1) diff --git a/app/src/main/java/net/foucry/pilldroid/dao/MedicDAO.java b/app/src/main/java/net/foucry/pilldroid/dao/MedicDAO.java index 56b2df5..bf1b3fc 100644 --- a/app/src/main/java/net/foucry/pilldroid/dao/MedicDAO.java +++ b/app/src/main/java/net/foucry/pilldroid/dao/MedicDAO.java @@ -1,32 +1,36 @@ package net.foucry.pilldroid.dao; -import android.arch.persistence.room.Dao; -import android.arch.persistence.room.Delete; -import android.arch.persistence.room.Insert; -import android.arch.persistence.room.Update; -import net.foucry.pilldroid.models.Medic; +import androidx.room.Dao; +import androidx.room.Delete; +import androidx.room.Insert; +import androidx.room.Query; +import androidx.room.Update; -import android.arch.persistence.room.Query; -import java.util.list; +import net.foucry.pilldroid.models.Medic; + +import java.util.List; @Dao public interface MedicDAO { - @Insert - public void insert(Medic... medics); - @Upfdate - public void update(Medic... medics); - @Delete - public void delete(Medic medic); + @Insert + void insert(Medic... medics); + + @Update + void update(Medic... medics); + + @Delete + void delete(Medic medic); + + + @Query("SELECT * FROM medics") + List getMedics(); + + @Query("SELECT * FROM medics WHERE id = :id") + Medic getMedicBy(Long id); + + @Query("SELECT * FROM medics WHERE cip13 = :cip13") + Medic getMedicByCIP13(String cip13); + + @Query("SELECT count(*) FROM medics") + int getMedicCount(); } - -@Query("SELECT * FROM medics") -public List getMedics(); - -@Query("SELECT * FROM medics WHERE id = :id") -public Medic getMedicBy(Long id); - -@Query("SELECT * FROM medics WHERE cip13 = :cip13") -public Medic getMedicByCIP13(String cip13); - -@Query("SELECT count(*) FROM medics") -public int getMedicCount();