guys, I am new to Java EE, and I'm now designing the service layer. I am very confused about what param should I pass to the method from my controller layer, the entire object? or just its essential params?
For example, if I want to create an article, here is the code.
The first way
public void createArticle(Article article) {
articleDAO.create(article);
}
The second way
public void createArticle(String title, String subtitle) {
Article article = new Article();
article.setTitle(title);
article.setSubtitle1(subtitle);
articleDAO.create(article);
}
so please help me, which way should I follow? I am so confused, thanks!
Aucun commentaire:
Enregistrer un commentaire