[jboss-user] [JBoss Seam] - Re: validation and persisting
miloslav.vlach
do-not-reply at jboss.com
Wed Aug 15 03:35:25 EDT 2007
There is code....
| @Name("requestAction")
| @Stateful
| @Restrict("#{identity.loggedIn}")
| public class RequestAction implements RequestActionLocal, Serializable {
|
| ....
|
| ....
| @ValidatedMethod(formName = "editForm", validators = { @CustomValidator(validatorClass = RequestSaveValidator.class, mapping = { "category", "requestType",
| "request" }) })
| @End(beforeRedirect = true)
| public String update() {
| log.info("adding the request #0", request);
| em.refresh(category);
| em.refresh(requestType);
|
| if (!requestType.getRequests().contains(request)) {
| requestType.getRequests().add(request);
| }
| request.setCategory(category);
| request.setAuthor(loggedUser);
| request.setCreated(new Date());
| request.setRequestType(requestType);
|
| em.persist(request);
| em.flush();
| return DefaultActions.EDITED;
| }
|
| @Begin(join = true, flushMode=FlushModeType.MANUAL)
| public String loadDetail() {
| edit();
| return DefaultActions.LOADED;
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4074291#4074291
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4074291
More information about the jboss-user
mailing list