I am 2 week old to EJB.
How do i wrap my entity bean with a session bean.
Eg : -
I am having a Entity bean EntityAccount.java and a session bean SessionAccount.java. Now i want to call the entity bean from this session bean. I don't want to use create method of entity bean. Is there any way by which i can call the entity bean without the create method ?
Please help me...
First conceptually are you very clear with what is entity bean and what is the differance between session and entity beans?.Its adviceable that you can read some books on EJB :Enterprise Java Beans by Richard Monson-Haefel from O'Reilly publications or any other which like.
>I don't want to use create method of entity bean. Is there >any way by which i can call the entity bean without the >create method ?
Remember create method is used for creating/inserting a new record/s into the database.If you want to fetch some already created record/s you need to use findByPrimaryKey method of HomeInterface.Base on your UseCase u need to use either of the two methods i.e create or finByPrimaryKey method .
Sorry i missed one point, on wraping entity with session bean its an easy stuff just make a Jndi lookup within your session bean buisness method and invoke ur entity bean field methods through home and remote interfaces of entity bean.Hope u know the bean development cycle.