[jboss-user] [Beginners Corner] - Noob in EJB3 :D

kamikadze do-not-reply at jboss.com
Wed Aug 5 16:57:19 EDT 2009


Hello,

I have entity bean eg:

@Entity
  | public class Apple()
  | {
  | @Id
  | public Integer id;
  | public String name;
  | }

Stateless Bean:

@Stateless
  | public class FruitManager implements FruitManagerRemote()
  | {
  |   public apple getAppleById(int id)
  |   {
  |      Apple apple=em.find(apple.class,1);
  |      return apple;
  |   }
  | }

Client Code:

public class Client {
  | 	public static void main(String[] args) {
  | 	Properties properties = new Properties();
  | 	//init of properties are here for jndi
  | 		Context context;
  | 		try
  | 		{
  | 			 context = new InitialContext();
  | 			 FruitManagerRemote fruit = (FruitManagerRemote)context.lookup("FruitManager/Remote");
  | 			 Apple apple=fruit.getAppleById(1); 
  | 	}
  | }


Why I can obtain Apple object at client side?
There are some error at client side (I can add stack trace tomorow).

If I made an Apple in FruitManager I can get it from client, but if it was persisted it can be send to client? Is it right behaviour?

Maybe at client side should I remove annotations?

Any ideas?

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4248241#4248241

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4248241



More information about the jboss-user mailing list