I have in my application a relationship that is designed like this:
and I'm trying to select all the chats that have at least one user as a friend.
basically, I want to execute this query:
SELECT c.* FROM CHAT c, USER u, UserChats uc
WHERE c.type = myType
AND u.isFriend = 1
AND c.id = uc.chatId
AND u.id = uc.userId
I haven't managed to find a way to execute this in the GreenDao libraries and was hoping someone will be able to help me with this.
EDIT:
This is what I have up to now:
List<UsersChats> list = usersChatsDao.queryDeep(
"WHERE T0." + UserDao.Properties.isFriend.collumnName + " = ? "+
"AND T1." + ChatDao.Properties.type.collumName + " = ?",
new String[] {"1", myType});
if(list != null && list.isEmpty() == false) {
List<Chat> chats = new ArrayList<Chat>();
for(UsersChats link : list) {
chats.add(link.getChat());
}
}