Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
17. Sep 2008, 11:06 CET | Link

Hi,

maybe this is a more or less dumb question: Is it necessary to annotate entity beans with @Name? @Name tells Seam to instantiate an object of this entity whenever it is referenced. But as I'm thinking about I'm pretty sure that I don't access a plain entity on my pages. Whether there is a h:dataTable which iterates over entity beans or - especially with user - a special component is set up by another bean and so on.

So I wonder if it's just fine to remove the @Name respectively is there any special reason why an entity should be annotated with @Name?

Thanks Jens

4 Replies:
17. Sep 2008, 12:14 CET | Link

You do not need the @Name-Annotation in a EntityBean, when you do your business stuff in a session bean!

In common, it is better to seperate Model from Controller!

So do your business relevant things only in session beans and use the @Name-Annotation in SessionBeans.

17. Sep 2008, 13:05 CET | Link

And there is really no specific reason why every entity in the docs and examples got @Names?

17. Sep 2008, 17:39 CET | Link

Perhaps because CRUD operations in the examples refer to the entity to create by name? If you don't want to bind directly an entity implementation to a view you can use:

@Factory("entityName")

and outject an interface or an abstract class (hiding actual implementation to the view), this is the Seam-ish implementation of the Factory pattern.

19. Sep 2008, 07:38 CET | Link

I knew it was a more or less stupid question. But thanks, I got it again.