[jboss-user] [JBoss Seam] - Event not raised with annotations - Bug?
ruettimac
do-not-reply at jboss.com
Sun Feb 10 03:14:00 EST 2008
Hi,
I have two methods raising an event - one raises the event, the other not. If I raise the event programmatically it works, but not while I am annotating the raise of the event.
First the method which does not raise the event with annotations:
| @RaiseEvent(value=SeamConstants.EVENT_SPORTEQUIPMENT_CHANGED)
| public String deleteSportEquipment(final SportEquipment pSportEquipment) throws PersistencyException {
| Validate.notNull(pSportEquipment, "Argument pSportEquipment is mandatory");
|
| try {
| SportEquipment toDelete = mEntityManager.merge(pSportEquipment);
| pSportEquipment.getCustomer().getSportEquipments().remove(pSportEquipment);
| mEntityManager.remove(toDelete);
| } catch (final Exception pException) {
| mLog.error("Failed to delete sport equipment #0 of customer #1", pException, pSportEquipment.getName(), pSportEquipment.getCustomer().
| getLogin().
| getSynonym());
| throw new PersistencyBackendException("exception.persistencybackend", pException);
| } finally {
| //Events.instance().raiseEvent(SeamConstants.EVENT_SPORTEQUIPMENT_CHANGED);
| }
|
| return NavigationConstants.REDISPLAY;
| }
|
The constant NavigationConstants.REDISPLAY simply returns null.
The second method which raises the event with annotations:
@RaiseEvent(value=SeamConstants.EVENT_SPORTEQUIPMENT_CHANGED)
| public String persistSportEquipment(final SportEquipment pSportEquipment) throws PersistencyException {
| Validate.notNull(pSportEquipment, "Argument pSportEquipment is mandatory");
|
| SportEquipment sportEquipment = null;
|
| // update first if id already set, if id is null we have a fresh sport equipment
| if (null != pSportEquipment.getId()) {
| sportEquipment = mEntityManager.merge(pSportEquipment);
| } else {
| sportEquipment = pSportEquipment;
| sportEquipment.getCustomer().getSportEquipments().add(sportEquipment);
| }
|
| try {
| mEntityManager.persist(sportEquipment);
| } catch (final Exception pException) {
| mLog.error("Failed to save changed for sport equipment #0 of customer #1", pException, pSportEquipment.getName(), pSportEquipment.getCustomer().
| getLogin().
| getSynonym());
| throw new PersistencyBackendException("exception.persistencybackend", pException);
| } finally {
| //Events.instance().raiseEvent(SeamConstants.EVENT_SPORTEQUIPMENT_CHANGED);
| }
|
| return NavigationConstants.SUCCESS;
| }
While looking at the code; Do you see anything that is wrong? The only difference I see is the return value. I validated, that if null is returned, the event is not fired. But If I return a value, the event is fired.
I suppose this is a bug?!
Regards,
Cyrill
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4128153#4128153
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4128153
More information about the jboss-user
mailing list