Skip to content

ToOne object is null inside com.jega.entity.UserEntity #994

@jegalirisoft

Description

@jegalirisoft

I've entity class with ToOne relation. when we query the parent class we are seeing the exception java.lang.IllegalStateException: ToOne object is null inside com.jega.entity.UserEntity

Entity class

@Entity
data class UserEntity(
    @Id
    var id: Long = 0,
    var name: String
) {
    var address: ToOne<AddressEntity>? = null
}


@Entity
data class AddressEntity(
    @Id
    var id: Long=0,
    var streetLine: String,
    var streetLine2: String,
    var locality: String,
    var city: String,
    var state: String,
    var zipcode: String,
    var landmark: String? = null
)

Exception


java.lang.IllegalStateException: ToOne object is null inside com.jega.entity.UserEntity
at io.objectbox.Cursor.nativeFirstEntity(Native Method)
at io.objectbox.Cursor.first(Cursor.java:197)
at io.objectbox.Box.getAll(Box.java:310)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions