-
1. Re: Design question: Why use @Name on Entities?
rmemoria Jul 30, 2007 7:43 PM (in response to smokingapipe)In my app I have an entity that is a session component.
This entity holds information about the user login (like ip address, connection date and time, etc) and is "persisted" by the authenticator bean.
After that it's just read by the app and never changed again.
Ok... I could have used an EntityHome, but it would requires me a few aditional lines of code.
regards,
Ricardo Memória -
2. Re: Design question: Why use @Name on Entities?
norman.richards Jul 30, 2007 11:55 PM (in response to smokingapipe)I can't think of any compelling cases where @Name is the best choice for an entity. If the entity only has one role, with no special creation logic (pre-configuration of attributes in components.xml) then it's a bit simpler just to use @Name.
-
3. Re: Design question: Why use @Name on Entities?
smokingapipe Jul 31, 2007 3:48 AM (in response to smokingapipe)Thanks for the info. I saw examples where the entities had @Name notations on them, so I started doing that, but that actually caused me a lot of confusion. When I use an outjection I can control the scope of components which are not @Named entities, but if it is @Named then the @Name setting controls the scope... that confused me a lot. It seems easier to just not put a @Name on the various entities, and use @Name only for actions. Then if I want to alias something I'll do that in components.xml, but I don't even need to do that. I would prefer to access userHome.instance instead of just user, because to me there's less ambiguity about which user I'm talking about with userHome.instance.
Thanks for clearing this up.