[seam-dev] declaratively beginning a LRC in Seam 3
Arbi Sookazian
asookazian at gmail.com
Fri Jan 29 16:34:22 EST 2010
I just was reading the code for one of the Seam 3 booking example classes (
http://anonsvn.jboss.org/repos/seam/examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking/BookingAgentBean.java
):
public
@Named("bookingAgent")
@Stateful
@ConversationScoped
class BookingAgentBean implements BookingAgent
{
private @Logger Log log;
@PersistenceContext(type = EXTENDED) EntityManager em;
@Inject Conversation conversation;
@Inject StatusMessages statusMessages;
@Inject BookingFormControls formControls;
@Registered User user;
//@Fires @Confirmed Event<BookingEvent> bookingConfirmedEvent;
@Inject BeanManager manager;
private Hotel hotelSelection;
private Booking booking;
private boolean bookingValid;
public void selectHotel(Hotel hotel)
{
// NOTE get a fresh reference that's managed by the conversational
persistence context
hotelSelection = em.find(Hotel.class, hotel.getId());
log.info("Selected the {0} in {1}", hotelSelection.getName(),
hotelSelection.getCity());
conversation.begin();
}
...
}
Note the programmatic use of beginning a LRC in the selectHotel() method
above (begin()). AFAIK, in CDI/Weld, we don't have the capability to
declaratively begin a LRC (like we do in Seam 2.x with @Begin) but can we do
something like write @Begin at method level in Seam 3 apps?
Also, is @ConversationScoped required if the component is @Stateful?
Conversation scope is current default for SFSBs in Seam 2.x.
I found the following example in the weld ref doc:
@ConversationScoped @Stateful
public class OrderBuilder {...}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/seam-dev/attachments/20100129/2a788b45/attachment-0001.html
More information about the seam-dev
mailing list