I just was reading the code for one of the Seam 3 booking example classes (<a href="http://anonsvn.jboss.org/repos/seam/examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking/BookingAgentBean.java">http://anonsvn.jboss.org/repos/seam/examples/trunk/booking/ejb-jar/src/main/java/org/jboss/seam/examples/booking/booking/BookingAgentBean.java</a>):<br>
<br><pre>public<br>@Named("bookingAgent")<br>@Stateful<br>@ConversationScoped<br>class BookingAgentBean implements BookingAgent<br>{<br> private @Logger Log log;<br><br> @PersistenceContext(type = EXTENDED) EntityManager em;<br>
<br> @Inject Conversation conversation;<br><br> @Inject StatusMessages statusMessages;<br><br> @Inject BookingFormControls formControls;<br><br> @Registered User user;<br><br> //@Fires @Confirmed Event<BookingEvent> bookingConfirmedEvent;<br>
@Inject BeanManager manager;<br><br> private Hotel hotelSelection;<br><br> private Booking booking;<br><br> private boolean bookingValid;<br><br> public void selectHotel(Hotel hotel)<br> {<br>         // NOTE get a fresh reference that's managed by the conversational persistence context<br>
hotelSelection = em.find(Hotel.class, hotel.getId());<br> <a href="http://log.info">log.info</a>("Selected the {0} in {1}", hotelSelection.getName(), hotelSelection.getCity());<br> conversation.begin();<br>
}<br></pre>...<br>}<br><br>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?<br>
<br>Also, is @ConversationScoped required if the component is @Stateful? Conversation scope is current default for SFSBs in Seam 2.x.<br><br>I found the following example in the weld ref doc:<br><br><font size="1">@ConversationScoped @Stateful<br>
public class OrderBuilder {...}</font><br>