[jboss-user] [JBoss Seam] - Domain design with EJB3 and Seam

c_inconnu do-not-reply at jboss.com
Tue Apr 10 09:03:24 EDT 2007


Hi,

My question is about access level modifiers in the model design (with EJB3 entity and Seam). For example, I'd like to have something like that :


  | @Entity
  | public class MyUser
  |     extends XXX
  | {
  |     private String login;
  | 
  |     protected MyUser()
  |     {
  |          // used by EJB3
  |     }
  | 
  |     public MyUser(String login)
  |     {
  |         this.setLogin(login);
  |     }
  | 
  |     public String getLogin()
  |     {
  |         return this.login;
  |     }
  | 
  |     protected void setLogin(String login)
  |     {
  |         this.login = login;
  |     }
  | }
  | 

So that "login" cannot be modified (~final). EJB3 specs allow the protected constructor (i don't know about the setter), but anyway, Seam requires a public no-args constructor and a public setLogin. For me that's not a good design practice since the entity is then merely a C struct.

What are your opinion about that ? Am i doing something wrong ?
Thanks

David

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4035954#4035954

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4035954



More information about the jboss-user mailing list