[jboss-user] [JBoss Seam] - Re: @In bijected attributes remaining null?
gregory.pierce@jboss.com
do-not-reply at jboss.com
Thu Nov 9 00:05:43 EST 2006
| package com.sojournermobile.service.model.user;
|
|
| import javax.persistence.*;
| import java.io.Serializable;
| import java.util.Collection;
|
| import org.jboss.seam.annotations.*;
| import static org.jboss.seam.ScopeType.SESSION;
|
| @Entity
| @Name("user")
| @Scope(SESSION)
| public class User implements Serializable
| {
| @Id
| @GeneratedValue(strategy = GenerationType.AUTO)
| private int id;
|
| @Column(unique = true)
| private String userName;
| private String password;
|
| public User()
| {
|
| }
|
| public User( String userName, String password )
| {
| this.userName = userName;
| this.password = password;
| }
|
|
| public int getId()
| {
| return id;
| }
|
| public void setId(int id)
| {
| this.id = id;
| }
|
|
| public String getUserName()
| {
| return userName;
| }
|
| public void setUserName(String userName)
| {
| this.userName = userName;
| }
|
| public String getPassword()
| {
| return password;
| }
|
| public void setPassword(String password)
| {
| this.password = password;
| }
|
| }
|
|
| package com.sojournermobile.service.webservices.user;
|
|
| import com.sojournermobile.service.model.user.Profile;
| import com.sojournermobile.service.model.user.User;
|
| import javax.ejb.Stateless;
| import javax.jws.WebMethod;
| import javax.jws.WebParam;
| import javax.jws.WebService;
| import javax.jws.soap.SOAPBinding;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
| import java.util.Date;
| import java.util.List;
|
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Out;
|
| @WebService
| @Stateless
| @Name("userController")
| @SOAPBinding(style = SOAPBinding.Style.RPC)
| public class UserController implements UserControllerIF
| {
| @PersistenceContext(unitName = "sojourner")
| EntityManager em;
|
| @In @Out
| private User user;
|
|
| public User getUser() {
| return user;
| }
|
| public void setUser(User user) {
| this.user = user;
| }
|
| @WebMethod
| public int getUserCount()
| {
| return ((Long) em.createQuery("select count(u) from User u").getSingleResult()).intValue();
| }
|
| @WebMethod
| public List getUsers()
| {
| return em.createQuery("select u from User u").getResultList();
| }
|
| public String register()
| {
| System.out.println("Registering user " + user);
| em.persist( user );
|
| return "happy";
| }
|
|
|
| }
|
| package com.sojournermobile.service.webservices.user;
|
| import javax.ejb.Local;
| import java.util.Date;
|
| @Local
| public interface UserControllerIF
| {
| public int getUserCount();
|
| public String register();
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984392#3984392
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984392
More information about the jboss-user
mailing list