Create a Comment entity named Comment.kt with the @Entity annotation to convert this class into an entity class. Here is the code of this model class:
@Entity
class Comment(text: String, postedBy: Profile) : Serializable {
@Id
@GeneratedValue
var id: Long? = 0
var text: String? = text
@JsonIgnore
@JsonProperty("accCreatedTime")
var accCreatedTime: Instant? = Instant.now()
@ManyToOne
@JoinColumn(name = "profile_id")
@JsonIgnoreProperties("username","password","email","accCreatedTime","firstName","lastName" , "contactNumber","dob","city","country")
var postedBy: Profile? = postedBy
}
Here we have three elements and one constructor. Here is the constructor:
@Entity
class Comment(text: String, postedBy: Profile) : Serializable {
-----
-----
}