Hi everyone,
getBookings() method calling many times, any one help me how to handle this part,
@Name("bookingManager") @Scope(ScopeType.SESSION) public class BookingManager { public List<Booking> getBookings() { findAllBooking(); return createBookingList(); } @Create public String findAllBooking() { Query query = em.createQuery("from Booking as booking" ); bookings = query.getResultList(); } }
<f:subview rendered="#{bookingManager.bookings}"> <h:dataTable value="#{bookingManager.bookings}"> </h:dataTable> </f:subview>
any one suggest me ...........
Don't call findAllBooking() in the getter! It is already @Create annotated and will be called when the Session bean is created.
Also look at this post (currently a couple of posts below this one) Similar Question