This content has been marked as final.
Show 3 replies
-
1. Re: Seam app, production server question...
gonorrhea Apr 2, 2009 1:19 AM (in response to sherkan777)If you need to use EJB container's services and component architecture/API (e.g., SFSB, SLSB, MDB, EJB timers, EJB interceptors, etc.) then you will need an EJB3 container and you may as well stick with JBoss AS as it's part of the EAP stack and it's free.
I believe you can still use JBoss Cache for clustering services w/o EJB container (i.e. Apache/Tomcat only).
Here is an article on using JBoss Cache with Spring: http://www.javaworld.com/javaworld/jw-10-2005/jw-1031-spring.html?page=4
You can still develop using Facelets/Richfaces/JSF/Seam w/o EJB3. Seam has POJO transaction support via @Transactional annotation, for example.
As far as modeling conversations go, a JavaBean (POJO) can be used in place of SFSB as long as you use conversation scope for that component.
Without EJB, remember that you will be losing CMT support (container managed transactions) offered by the EJB container and you may have to demarcate transaction boundaries programmatically (like you do with BMT). Double check on that as I'm not quite sure... -
2. Re: Seam app, production server question...
gonorrhea Apr 2, 2009 1:31 AM (in response to sherkan777)from the Seam ref doc:
Seam JavaBean components do not provide declarative transaction demarcation like session
beans do. You could manage your transactions manually using the JTA UserTransaction or
declaratively using Seam's @Transactional annotation. But most applications will just use Seam
managed transactions when using Hibernate with JavaBeans.An example of a Seam JavaBean component from the examples\hibernate project:
//$Id: HotelBookingAction.java 6987 2007-12-23 19:53:07Z pmuir $ package org.jboss.seam.example.hibernate; import java.util.Calendar; import org.hibernate.Session; import org.jboss.seam.annotations.Begin; import org.jboss.seam.annotations.End; import org.jboss.seam.annotations.In; import org.jboss.seam.annotations.Logger; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Out; import org.jboss.seam.core.Events; import org.jboss.seam.faces.FacesMessages; import org.jboss.seam.log.Log; @Name("hotelBooking") public class HotelBookingAction { @In private Session bookingDatabase; @In private User user; @In(required=false) @Out private Hotel hotel; @In(required=false) @Out(required=false) private Booking booking; @In private FacesMessages facesMessages; @In private Events events; @Logger private Log log; private boolean bookingValid; @Begin public void selectHotel(Hotel selectedHotel) { hotel = (Hotel) bookingDatabase.merge(selectedHotel); } public void bookHotel() { booking = new Booking(hotel, user); Calendar calendar = Calendar.getInstance(); booking.setCheckinDate( calendar.getTime() ); calendar.add(Calendar.DAY_OF_MONTH, 1); booking.setCheckoutDate( calendar.getTime() ); } public void setBookingDetails() { Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_MONTH, -1); if ( booking.getCheckinDate().before( calendar.getTime() ) ) { facesMessages.addToControl("checkinDate", "Check in date must be a future date"); bookingValid=false; } else if ( !booking.getCheckinDate().before( booking.getCheckoutDate() ) ) { facesMessages.addToControl("checkoutDate", "Check out date must be later than check in date"); bookingValid=false; } else { bookingValid=true; } } public boolean isBookingValid() { return bookingValid; } @End public void confirm() { bookingDatabase.persist(booking); facesMessages.add("Thank you, #{user.name}, your confimation number for #{hotel.name} is #{booking.id}"); log.info("New booking: #{booking.id} for #{user.username}"); events.raiseTransactionSuccessEvent("bookingConfirmed"); } @End public void cancel() {} }
-
3. Re: Seam app, production server question...
sherkan777 Apr 3, 2009 1:13 PM (in response to sherkan777)Thank You Ron for explanation.
That was what I was looking for.