[jboss-user] [JBoss Seam] - Re: Should you allow @Name on entity beans?

nickarls do-not-reply at jboss.com
Sun Oct 21 03:44:27 EDT 2007


"samdoyle" wrote : By doing this it makes it easier to do things like embed logic into entity beans which is not their intended use. A colleague of mine who is brand new to EJB3 and Seam did that just the other day and I was like  wow, that is pretty odd.
  | 

I would have to strongishly disagree (although I know this is a religious issue). I think logic *should* be in the entity beans. Most definitions of object-oriented design goes something like 

"Each class encapsulates some data and all operations upon that data".

Personally I try to avoid using entity beans as dumb DTO:s. It seems so pre-EJB3:ish. "Why do we need a DTO?" "Hmm. Because we always have had them. Now be quiet and code" :-)

Yes. If an entity needs data, I pass in a repository so that it can use it itself (or even have the method lookup the repository itself) instead of having someone else do it and pass in the data.

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

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



More information about the jboss-user mailing list