The problem in your case is that if you have values ββwith a null value, Kotlin will generate multiple constructors for each possible constructor.
This means that you must define a default constructor and populate it with default values.
If you want to have one more that should be ignored, you should definitely use a parent constructor with all of these options.
Example:
@Entity(tableName = "inspections") data class Inspection( @SerializedName("id") var id: Int = 0, @PrimaryKey @SerializedName("guid") var guid: String = "", @SerializedName("score") var score: Double = 0.0, @SerializedName("notification_sent_at") var notificationSentAt: Date = Date(), var wasUploaded: Boolean = false) { @Ignore constructor() : this(0, "", 0.0, Date(), false) }
In this case, only two constructors will be generated βunder the hoodβ. If you have values ββwith a null value, you will have all the constructors available.
Example:
data class Test(var id: Int = 0, var testString: String? = null, var testBool : Boolean? = null) { constructor(0) }
generates
constructor(var id:Int) constructor() : this(0) constructor(var id:Int, var testString: String) constructor(var id:Int, var testBool: Boolean) constructor(var id:Int, var testString: String, var testBool : Boolean)
Since you are looking for official documentation, you can see "Overload Generation" .
After testing your class, which works flawlessly, I found in another post that you should check if you use apply plugin: 'kotlin-kapt' in your Gradle.
Double check that you have valid type converters for your Date class. I wrote which gave out more time ago.
After transcoding your things above, he did a great job by adding the UserPermissions class:
data class UserPermissions(var permissionid: String)
Edit: after using your UserPermission class, everything worked fine. Please take care if you use the correct import (util.Date instead of sql.Date, for example).
Another problem is that you are using the old very complex room library.
The current version (when writing this) is
implementation "android.arch.persistence.room:runtime:1.0.0-beta2" kapt "android.arch.persistence.room:compiler:1.0.0-beta2" implementation "android.arch.persistence.room:rxjava2:1.0.0-beta2"
I wrote a question for a long time