Re EJB3 Entities:
anonymous wrote : Not quite, they are only components if the have @Name (in
which case they would be CONVERSATION scoped). The "preferred" way to do this
is to use Home objects to manage an Entity, rather than expose it directly with
@Name, and uses pages.xml for wiring. We could probably do with an example app
built using Seam-gen that does a couple of simple CRUD operations
Yep, it was late, I forgot I overrode the scope on some of my entities.
However there are plenty of times where simple CRUD doesn't fit the bill. If
you're actually managing an entity, sure, use a Home. However if you're using
a form to populate an entity for another purpose, using Seam to populate a
scoped entity and hand it off for further processing has advantages. Of course
the entity doesn't need to be an EJB 3 entity. Seam does the same for POJOs.
For example I don't think I'd recommend using a Home to populate a search
prototype. For search pages, an entity with an event scoped role combined with
Hibernate's Criteria API + Example criterion is great.
In general if I'm not doing CRUD I prefer to decouple the entity population and
the controller doing the work. Prior to Seam I had to populate
#{someController.entity.value1}. Now that I can simply work with
#{entity.value1} means I have some additional flexibility.
What would be really great would be to put out a Seam cookbook. About @Unwrap,
Pete is right, most people just want a contextual variable to go from void (not
there), to initialized, and that's usually the job for @Factory. However the
managed component pattern can be useful not just for scafolding and exposing
non-Seam services. For an example you could have a managed component observe
many events that happen within your system and change the underlying
representation as a result of those observations. With the managed component
pattern a component can manage these actions itself and because the component
is unwrapped on every access, all callers will have a consistent view. This is
a much different use than what Factories provide for.
I wasn't sure exactly what the user wanted so figured I'd lay out everything
and let him choose.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4039566#4039566
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4039566
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user