Updating dao with a new query

This commit is contained in:
BGbaderguet 2020-12-29 17:29:37 +01:00
parent 0be4898b7d
commit 132aeadd54

View File

@ -1,5 +1,6 @@
package fr.romanet.vj.apps.myrealestateagency.dao;
import androidx.lifecycle.LiveData;
import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;
@ -12,11 +13,14 @@ import fr.romanet.vj.apps.myrealestateagency.entities.Agent;
public interface AgentDao {
@Query("SELECT * FROM agent")
List<Agent> getAgentList();
LiveData<List<Agent>> getAgentList();
@Query("SELECT agency_name FROM agency INNER JOIN agent ON agent.agent_id = agency.agency_id WHERE agent.agency_employer_id = :idAgencyEmployer")
String getAgencyName(int idAgencyEmployer);
@Insert
void insertAgent(Agent agent);
@Insert
void insertPreAgents(Agent[] agents);
}