Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Best Practice Questions: Method signature for CRUD operations

843830Aug 3 2010 — edited Aug 3 2010
Hi,

I am reading a book about EJB3.0 which has been very helpful to me so far. However I now find myself in a dilemma which is not clearly covered in the book and I would really like to know how best to proceed. In the book it says that an Entity Manager wrapper class (responsible to handle all CRUD operations for a particular object) can have several methods. One of the methods it describes is as follows;
addUser(String username, String password, String name, String surname, etc){ ... }
Note that in the above method the book does not pass the User object as a parameter to the method but rather the attributes of the User object. Therefore my first question is this;

Is there any benefit / drawback in writing the addUser(...) method in this way? or it is better to write it as follows;
addUser(User user){ ... }
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 31 2010
Added on Aug 3 2010
1 comment
303 views