This content has been marked as final.
Show 2 replies
-
1. Re: Raising Asynchronous events doesnt work
cash1981 Apr 1, 2009 4:19 PM (in response to cash1981)Small update here.
It seems the event IS called, however it doesnt persist.Events.instance().raiseAsynchronousEvent("storeSystemlog", Messages.instance().get("admin.userAdded").replaceAll("#0", currentUser.getUsername()), Messages.instance().get("security"), (adminLoggedIn != null ? adminLoggedIn.getUsername() : ""));
@Observer("storeSystemlog") public void saveSystemlog(String description, String category, String username) { SystemLog syslog = new SystemLog(); syslog.setCategory( (category == null ? "" : category) ); syslog.setDescription((description == null ? "" : description)); syslog.setDate(new Date()); syslog.setUsername((username == null ? "" : username)); entityManager.persist(syslog); }
-
2. Re: Raising Asynchronous events doesnt work
cash1981 Apr 1, 2009 4:25 PM (in response to cash1981)Last update:
I found the error. It was because my entityManager was not transactional because of the component being a JavaBean :-(@Transactional seemed to do the trick