Questions tagged [android-room-relation]
69 questions
0
votes
1 answer
use orderBy to get embedded relation-defined table from Android Room
For this transaction Query in Android Room :
@Transaction
@Query("SELECT * FROM TPAGroup WHERE zuid=:zuid ORDER BY `index`")
fun getGroupWithSecretsForZuid(zuid: String): List
and this as my data class :
data class…

Divesh
- 112
- 1
- 6
0
votes
1 answer
Android Room embedded relationship query results
I am currently trying to get results from a query of nested relationships in Room. Here Are my classes/database entities involved:
@Entity
data class PrayerRequestEntity(
var title: String,
var details: String,
var category: String,
…

Martin
- 166
- 1
- 15
0
votes
1 answer
Android room DB - Handling of foreignKeys in DB upgrade and Altering the table
I'm using a room DB. I've 2 tables A and B.
The primary key of A is foreign key in Table B.
Below is my DB structure -
@Entity(tableName = "A")
data class A(
@PrimaryKey
@NotNull
@ColumnInfo(name = "IDKEY")
var xID:…

Amrut
- 2,655
- 3
- 24
- 44
0
votes
2 answers
Android room Database deletion not working
I am working with a Room DB for recycler view. And there is a delete icon on each row to delete that item. I want to delete same item from the Room db also. I have done below code but it's only reflecting in the list and after refresh that again…

Malhotra
- 221
- 3
- 13
0
votes
2 answers
Deconflict column names in "join" entity
I have 2 entities:
@Entity(tableName = "author")
data class Author(
@PrimaryKey
@ColumnInfo(name = "id")
val id: String,
@ColumnInfo(name = "name")
val name: String
)
data class Book(
@ColumnInfo(name = "id")
val id: String,
…

lostintranslation
- 23,756
- 50
- 159
- 262
0
votes
1 answer
Unique constraints is not working in room database in android
@Entity(tableName = "DailyGraphData", indices = [Index(value = arrayOf("lastTimeUsed","beginningTime"), unique = true)])
data class DailyGraphData(
@PrimaryKey(autoGenerate = true)
val id: Int = 0,
var appName: String,
var…

MARSH
- 117
- 1
- 7
- 22
0
votes
1 answer
Room database with one-to-one relation like Address, City and State
I looked in the android documentation for an answer to my question, but I couldn't find it. To create a recyclerview using the information contained in these classes, how can I get a list of this information in Room
@Entity(
foreignKeys = [
…

Rodrigo
- 61
- 2
- 6
0
votes
1 answer
i was trying to add data in room db but not able to add more than 50 rows
I was trying to add some data in room database android. but while adding there is only 50 rows are visible or entered in db. there is no more data is able to add in db. I also check my logs but there is no error or exception. I print each data in…
0
votes
1 answer
It is possible to map this scenario on room directly?
I have these relationships:
Customer > Address
Customer > Property
Property > Address
So I'm trying to do this:
data class DetailedCustomerInformation(
@Embedded
val customer: Customer,
@Relation(parentColumn = "addressId", entityColumn…

Luis Fernando
- 11
- 2
0
votes
1 answer
Room many to many relation is not working
I followed the same tutorial from Android and created a many to many relation in my Room tables. But I am getting a strange behavior which is working till the first step, but not working for the relations.
Mostly I created some tables and trying to…

Dimitri Payet
- 187
- 2
- 12
0
votes
1 answer
How to accessing data using Room DAOs to retrieve data from multiple tables
I'm trying hard but I get no result, I want to get all the information about the product besides the name of the category, and the name of the unit because I want to show all of this information inside my adapter what is the best practice to do it,…

labed AbdelJalil
- 15
- 1
- 7
0
votes
1 answer
Android Room Relation returns an invalid list
I have a query with a complex relation.
data class GameWithHouseworkResult(
@Embedded val game:GameClass,
@Relation(
entity = GameHouseworkResult::class,
parentColumn = "gameId",
entityColumn =…

VNprk
- 13
- 4
0
votes
1 answer
Data class with 2 entites confuses columns
I have two entities in my room database in an Android application.
The concept is that every Site has many Groups.
@Entity(tableName = "sites")
data class Site(
@ColumnInfo(name = "server_id")
var serverId: Long,
@PrimaryKey
…

james04
- 1,580
- 2
- 20
- 46
0
votes
1 answer
Many to many android room ref extra variable
I have a Many to Many relationship set up on my Room database denoted by the following diagram:
eveything works great but I would like to make the following addition:
My question is how do I go about having RecipeWithIngredients get this…

barryalan2633
- 610
- 7
- 21
0
votes
2 answers
How to create Entity class for nested object in room database
I'm getting below response from GitHub API
{
"url": "https://api.github.com/repos/square/okhttp/issues/6235",
"repository_url": "https://api.github.com/repos/square/okhttp",
"labels_url":…

Goku
- 9,102
- 8
- 50
- 81