Reputation: 7828
I didn't really expect this to work, but can Android Room @Relation be filtered with a WHERE
clause. For example:
SELECT * FROM meta WHERE subjectId IN (?)
@RawQuery(observedEntities = [ MetadataEntity::class, SubjectJunction::class ])
internal abstract fun internalGetImages(query: SupportSQLiteQuery): LiveData<List<MetadataXmp>>
`
data class MetadataXmp @JvmOverloads constructor(
@Embedded
val metadata:MetadataEntity,
@Relation(
parentColumn = "id",
entityColumn = "metaId",
projection = ["subjectId"],
entity = SubjectJunction::class)
var subjectIds: List<Long> = Collections.emptyList())
This throws no such column: subjectId
. I suspect that @Relation
is only gathered based on the core query result and the relational columns are never present for the initial query, but I wanted to see if the relation could referenced.
Upvotes: 0
Views: 1579