[
https://issues.jboss.org/browse/JBSEAM-4966?page=com.atlassian.jira.plugi...
]
Vaclav Dedik edited comment on JBSEAM-4966 at 8/16/12 5:17 AM:
---------------------------------------------------------------
I fixed this bug in groovybooking by introducing @Observer annotation on the factory
getBookings() and by raising the event in the confirm action. I think it's a much
better solution and it's consistent with the booking example where it is done the same
way.
{code}
@End
void confirm()
{
em.persist(booking)
facesMessages.add "Thank you, #{user.name}, your confimation number for
#{hotel.name} is #{booking.id}", new Object[0]
log.info("New booking: #{booking.id} for #{user.username}")
events.raiseTransactionSuccessEvent("bookingConfirmed")
}
{code}
{code}
@Factory
@Observer(["bookingConfirmed"])
public void getBookings()
{
bookings = em.createQuery('''
select b from Booking b
where b.user.username = :username
order by b.checkinDate''')
.setParameter("username", user.username)
.getResultList()
}
{code}
See these two commits:
https://source.jboss.org/changelog/Seam?cs=15048
https://source.jboss.org/changelog/Seam?cs=15050
was (Author: vdedik):
I fixed this bug in groovybooking by introducing @Observer annotation on the factory
getBookings() and by raising the event in the confirm action. I think it's a much
better solution and it's consistent with the booking example where it is done the same
way.
{code}
@End
void confirm()
{
em.persist(booking)
facesMessages.add "Thank you, #{user.name}, your confimation number for
#{hotel.name} is #{booking.id}", new Object[0]
log.info("New booking: #{booking.id} for #{user.username}")
events.raiseTransactionSuccessEvent("bookingConfirmed")
}
{code}
{code}
@Factory
@Observer(["bookingConfirmed"])
public void getBookings()
{
bookings = em.createQuery('''
select b from Booking b
where b.user.username = :username
order by b.checkinDate''')
.setParameter("username", user.username)
.getResultList()
}
{code}
Factory not called after @Outjecting null value with redirect
-------------------------------------------------------------
Key: JBSEAM-4966
URL:
https://issues.jboss.org/browse/JBSEAM-4966
Project: Seam 2
Issue Type: Bug
Components: Core
Affects Versions: 2.3.0.BETA2
Environment: AS 7.1.2.Final
Reporter: Marek Schmidt
Fix For: 2.3.0.CR1
The following scenario which works in Seam2.2, doesn't work in Seam2.3.0.Beta2
{code}
@Scope(ScopeType.SESSION)
@Name("bookingList")
class BookingListAction implements Serializable
{
@DataModel
private List<Booking> bookings
@Factory
public void getBookings() {
// load bookings from the database
}
}
{code}
{code}
@Name("hotelBooking")
public class HotelBookingAction
{
@Out (required=false, scope=ScopeType.SESSION)
List <Booking> bookings;
@End
public void confirm() {
// ... persist a new booking
// force refresh
bookings = null;
}
}
{code}
{code}
<page view-id="/confirm.xhtml"
conversation-required="true">
<description>Confirm booking: #{booking.description}</description>
<navigation from-action="#{hotelBooking.confirm}">
<redirect view-id="/main.xhtml"/>
</navigation>
</page>
{code}
The getBookings factory is not called at all after the confirm action. It works correctly
if I remove the redirect rule in pages.xml (by making the confirm action return
"main".).
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see:
http://www.atlassian.com/software/jira