Thursday, October 25, 2007

EJB interview questions Part5


7. Why does EJB needs two interface (Home and Remote Interface) ?

To handle the network tranport layer. TODO I do not have much knowledge to explain further.

8. What are the methods of Entity Bean?

setEntityState
create
ejbCreate
ejbPostCreate
ejbActivate
ejbPassivate
remove
ejbRemove
unsetEntityState

9. How is entity bean created using Container managed entity bean ?

In both container managed and bean managed when the client calls create the call is passed on to ejbCreate.

In a container managed bean ejbCreate method will initialize all instance variables based ont he input arguments passed in. Once ejbCreate method completesthe container will automatically persist the bean. ejbCreate would return null.This is because: it is not practially possible to generate a primary key in ejbCreate and it would be impossible to get hold of the primary key for a row in a table even before the row exists as storage happens only after
ejbCreatecall completes.

In a bean managed persistance the ejbCreate will perform the fallowing:
i. Create an entry in the database
ii. Initialize the instance variables
iii. Return the primary key.

0 comments:

Advertisement

 

Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com