question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unresolved reference: oneToMany

See original GitHub issue

Android Studio 3.0 Beta 2 DBFlow Version: 4.0.5 Issue Kind (Bug, Question, Feature): Question

Description: Maybe I don’t understand something in this life, but I got issue with oneToMany delegated property. It shows me “Unresolved reference” and I don’t know why. 16-08-2017 010222

Code:

@Database(version = DatabaseObject.VERSION, name = DatabaseObject.NAME, backupEnabled = true, consistencyCheckEnabled = true)
object DatabaseObject {
    const val VERSION = 1
    const val NAME = "AppDatabase"
}

@Table(database = DatabaseObject::class)
data class Musician(
        @PrimaryKey(autoincrement = true) var id: Long,
        @Column var artistName: String,
        @Column var itunesID: Long,
        @Column var itunesAMGID: Long,
        @Column var itunesGenre: String
){
    @get:OneToMany(methods = arrayOf(OneToMany.Method.ALL))
    var collections by oneToMany { select from Collection::class where (Collection_Table.musician.artistName.eq(artistName)) }
}

@Table(database = DatabaseObject::class)
data class Collection(
        @PrimaryKey(autoincrement = true) var id: Long,
        @ForeignKey(stubbedRelationship = true) var musician: Musician // ВНИМАНИЕ! Добавление идет не из конкретной коллекции iTunes, а из музыканта, для которого эти коллекции были получены
        )

I used an example from page https://agrosner.gitbooks.io/dbflow/content/Relationships.html and little edits to support mine tables

My Gradle:

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion 26
    buildToolsVersion "25.0.3"
    defaultConfig {
        applicationId "com.aqluse.itunesartistfeed"
        minSdkVersion 24
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:26.0.1'
    compile 'com.android.support:design:26.0.1'
    compile 'com.android.support:support-v4:26.0.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"

    // Библиотеки проекта
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile('com.mikepenz:materialdrawer:5.9.5@aar') {
        transitive = true
    }

    def dbflow_version = "4.0.5"
    annotationProcessor "com.github.Raizlabs.DBFlow:dbflow-processor:${dbflow_version}"
    kapt "com.github.raizlabs.dbflow:dbflow-processor:$dbflow_version"
    compile "com.github.Raizlabs.DBFlow:dbflow-core:${dbflow_version}"
    compile "com.github.Raizlabs.DBFlow:dbflow:${dbflow_version}"
    compile "com.github.Raizlabs.DBFlow:dbflow-kotlinextensions:${dbflow_version}@aar"
}
repositories {
    mavenCentral()
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
Aqlusecommented, Aug 31, 2017

@agrosner after I updated to 4.1.0 from 4.0.5 it become recognizable for import. At the moment I found the issue, 4.0.5 seemed to be a recent version of library and oneToMany wasn’t importable at all, but docs contained example with this extension. So problem have been resolved, but I need to check if it really works before close the issue.

0reactions
agrosnercommented, Aug 30, 2017

yeah it was released for 4.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring unresolved forward reference in Many to One
I have a task and a user entity, with a one-to-many relationship. ... Unresolved forward references for: ; nested exception is ...
Read more >
Java Spring Boot REST API - Unresolved forward references ...
Coding example for the question Java Spring Boot REST API - Unresolved forward references for one-to-many relationship-Springboot.
Read more >
IoJjmY - Online IDE & Debugging Tool - Ideone.com
Compile various programming languages online. Add input stream, save output, add notes and tags.
Read more >
Hibernate ORM 6.1.6.Final User Guide - Red Hat on GitHub
Hibernate maps Currency references to VARCHAR JDBC type. Example 59. ... private String password; private int accessLevel; @ManyToOne(fetch = FetchType.
Read more >
Room - Android Developers
API Reference androidx.room · androidx.room.migration ... One-to-Many Relation Map (Standard multimap). @Query("SELECT * FROM Artist JOIN Album ON Artist.id ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found