views:

15

answers:

0

i have this in the server:

class Person{...}

and

@Stateless
public class HelloServiceBean implements HelloServiceLocal, HelloServiceRemote {
    public Person getPerson(String name) {
        return new Person(name);
    }
}

And i have this in my client (in some different JVM):

  public static void main(String[] a) throws Exception{
        String name = "java2s";
        HelloServiceRemote service = null;

        service = (HelloServiceRemote)new InitialContext().lookup("HelloServiceBean/remote");
        Person p = service.getPerson(name));
   }

When i need to call, for example, getPerson() method from my EJB, which return an object of type of Person, how my client is going to understand that Person is a class ?

Do i have to re-write the Person class another time in my client (and also the HelloServiceRemote class), so it can understand what is a Person ? Or do i have to include the Ejb project into my client project ?