The @Name on entity classes is already handled as a special case. Method interception is disabled. Here is what the @Name gives you for entity classes:
1. give access to entity class via a context variable name for convenience of capturing form data related to the entity without needing to do a factory or other type of initialization
2. allow a default scope to be assigned so that, again, you don't have to do special factory stuff to get a fresh entity instance in conversation scope (which is the default)
3. ability to create a prototype of an entity class using component configuration (configure the properties in components.xml)
I don't think there is any harm in doing it. Whether or not you choose to make your entity classes Seam components by giving them a @Name annotation is up to you. If you don't use the @Name annotation, you can always do the same thing via XML in components.xml. There really is no harm in doing so.
Remember, entity class components are restricted components in that they have:
no event handling
Hello Dan and thanks for the clarification.
I'm still myself fairly new to Seam myself but we are considering using it in two new projects based on successful results in prototyping.
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.
I would avoid putting @Name on entity beans.
1) It's not good if you decide to cluster your app
2) I find the lifecycle easier to understand if I use a factory (really easy via components.xml)
3) I find it provides a simpler architecture.