February 2019
Intermediate to advanced
442 pages
11h 46m
English
The entity class for comments table should look as follows:
@Entity@Table(name="comments",catalog="task_mgmt_system")class Comments { @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private var id :Int?=null @ManyToOne @JoinColumn(name = "user_id",nullable = false) private var user : User? = null @ManyToOne @JoinColumn(name = "task_id", nullable = false) private var task : Task? = null; private var comment:String? = null // .. Getters and Setters}
The @ManyToOne annotation is used to declare a many-to-one relationship with a task table. The @JoinColumn annotation is used to define the reference column (primary key).