objectbox / objectbox-java

Android Database - first and fast, lightweight on-device vector database
https://objectbox.io
Apache License 2.0
4.39k stars 302 forks source link

Build failed if entity put on different package #200

Closed nonsensecreativity closed 6 years ago

nonsensecreativity commented 7 years ago

Issue Basics

Code to reproduce the bug

package com.domain.project.entities.orders

import com.domain.project.entities.users.User
import io.objectbox.annotation.Entity
import io.objectbox.annotation.Id

@Entity
data class Order(@Id var id: Long = 0) {
    lateinit var users: ToMany<User>
}
package com.domain.project.entities.users

import io.objectbox.annotation.Entity
import io.objectbox.annotation.Id

@Entity
data class User(@Id var id: Long = 0)

Logs & stackstraces

Misc

Did you find any workarounds to prevent the issue? Yes, put every file in the same package. I try to separate some files into specific domain package due to having lot of entities

greenrobot-team commented 6 years ago

Thanks for reporting. Turns out the ObjectBox code generator did only add missing imports if there was a ToOne, but not if there is only a ToMany. This should be fixed with the next release of the plugin. -ut

motis10 commented 6 years ago

Whats new with this issue? It's real problem.

greenrobot commented 6 years ago

We'll release 1.2 shortly.

motis10 commented 6 years ago

Do you have an ETA?

greenrobot commented 6 years ago

Please check the just uploaded version 1.2.0-RC to confirm its working now.

motis10 commented 6 years ago

What do you mean? How can i use the RC version?

greenrobot commented 6 years ago

Use "1.2.0-RC" as a version in your Gradle script.

motis10 commented 6 years ago

Thanks

greenrobot commented 6 years ago

http://objectbox.io/objectbox-1-2-livedata/

motis10 commented 6 years ago

Im not sure its perfectly fixed. MyObjectBox.builder().androidContext(this).name("OB").build(); The imports are from: contacts.model.objectbox.MyObjectBox

But who choose that package? In the jenkins its compile it to defferent package