In this chapter, we will create entities to represent a forum application. The main entities involved in a forum are the forum itself (which exposes the argument), the topic that exposes the questions of the argument, the posts (the responses), and the category of a forum.
So we can start with the upper level, the category:
@Entity
@Table(name = "JBP_FORUMS_CATEGORIES")
public class Category implements Serializable {
@Id
@Column(name = "JBP_ID")
@GeneratedValue
private Integer id;
}
The @Entity annotation specifies that the bean we have written is an entity. An entity is an object representing a table in a relational database. The @Table annotation maps the entity to the relational table of a database. If the @Table is not specified, the entity will be mapped with a relational table represented by the simple name...