Here is the stateful session bean:
| @Stateful
| @Scope(EVENT)
| @Name("createRecruiter")
| @Interceptor(SeamInterceptor.class)
| public class CreateRecruiterAction implements CreateRecruiter {
|
| private static final Logger log =
Logger.getLogger(CreateRecruiter.class);
|
| @In @Valid
| private Recruiter recruiter;
|
| @PersistenceContext
| private EntityManager em;
|
| @In
| private FacesContext facesContext;
|
| @IfInvalid(outcome=REDISPLAY)
| public String createRecruiter() {
| log.info("creating recruiter");
| List existing = em.createQuery("select socialSecurityNum from Person
where socialSecurityNum=:socialSecurityNum")
| .setParameter("socialSecurityNum",
recruiter.getSocialSecurityNum())
| .getResultList();
| if (existing.size()==0) {
| em.persist(recruiter);
| em.flush();
| return "login";
| } else {
| //String ssno = existing.get(0);
| facesContext.addMessage(null, new FacesMessage("recruiter already
exists"));
| return null;
| }
| }
|
| @Destroy @Remove
| public void destroy() {
| log.info("destroyed");
| }
| }
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3931676#3931676
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3931676
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user