• Post Reply Bookmark Topic Watch Topic
  • New Topic

A Question asked during interview

 
Sajee Joseph
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I have a Question that was asked during interview.
Suppose i write a Stateful session bean. But in the deployment descriptor i mention it as "STATELESS". what will happen?
What i answered is that : The code will still compile. But the bean will still behave as a Stateless one, coz that how its set in the Deployment descriptor.
Am i right? Any answers on this?

Regards,
Sajee
 
Yi Meng
Ranch Hand
Posts: 270
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From EJB spec 7.8
The home interface of a stateless session bean must have one create method that takes no arguments.
The create method of the remote home interface must return the session bean�s remote interface. The
create method of the local home interface must return the session bean�s local interface. There can be
no other create methods in the home interface. The session bean class must define a single ejbCreate
method that takes no arguments.


1. Compilation is not of consideration since you are talking about deployment. (i.e. you must have first successfully compiled all the source before you proceed to deployment). BTW, compilation has nothing to do with the DD and as per java rule, stateless and stateful bean class files are of no difference at all -- they extend/implement the same classes/interfaces.
2.a. If your statefull bean happened to have only one create method without any argument just as per stateless bean, it will behave like a stateless bean.
2.b. Else, it may lead to direct deployment failure or ...... who knows ...... since it is not expicilitly expressed in the spec.
[ June 14, 2004: Message edited by: Yi Meng ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!