I am new to JSF and I wonder if I understood correctly. Say I have a simple CMS that allows you to write pages.
First, I define a JPA object named Page:
@Entity
public class Page {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column
private Long id;
@Column private String title;
@Column private String content;
}
Then I would like to create a page. For this, it seems to me that I need a bean page. At the moment, I did such things:
@Model
public class PageBean {
private Page page = new Page();
public String getTitle() {
return page.getTitle();
}
public void setTitle(String title) {
page.setTitle(title);
}
public void save() {
}
}
My question is this: given that my JPA entity model and the model I want to use in the views are exactly the same in most cases, is there a way to avoid creating a batch of getters and setters in PageBean?
- , bean JPA JSF- bean ( JSF , JPA), , . , beans, , .