Ramakrishna Allam

Ranch Hand
+ Follow
since Mar 23, 2004
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ramakrishna Allam

Thanks everybody .
16 years ago
Guys ,
I am happy to share my experiences with you . I just scored SCBCD with 98%. One question went wrong . Thats a drag and drop question . The thing is it didnt allow me to answer . When I am trying to drang it , it was giving some script error . I complained to the prometric centre guys . They couldnt help me . Otherwise , I would have got 100%. But still I am heppy.

If youy are looking for some preparatory books , its none other than HFEJB . Pnly with this book u can score 90%+ . But u should understand in and out of it . Ofcourse , I studied EJB spec also . revised the theoritical concepts like EJB env , security , responsibilities of different roles , EJB QL and Entity beans chapter . It was tough going thru that. I studied Mikalai Zaikin's SCBCD Guide .I went through only the theoritical chapters that I mentioned above . Thats a good notes . Otherthan that , as everytime it is proved , mock exams is a muct . I gave it on ejbcertificate.com , jdiscuss mocks . The real exam is a bit easier than ejbcertificate.com . And also this forum is of great use .

In the end , Many many thanks to Kathy for a such a nice funny book .
16 years ago
instead of using collections and adding it specifically , if u use set methods of the bean , no need to remove them specifically . Container takes care of it.
You are right . U need to have a specific code to remove it through Iterator.remove() . otherwis e, u will see a IllegalStateException
Infcat what he says on the page 135 of the spec is ,

If elements are added or removed from the underlying
container-managed collection used by an iterator other than by the java.util.Iterator.remove() method, the container should throw the
java.lang.IllegalStateException on the next operation on the iterator
Collection nySalesreps = nyOffice.getSalesreps();
Collection sfSalesreps = sfOffice.getSalesreps();
Iterator i = nySalesreps.iterator();
Salesrep salesrep;
// a wrong way to transfer the salesrep
while (i.hasNext()) {
salesrep = (Salesrep)i.next();
sfSalesreps.add(salesrep); // removes salesrep from nyOffice
// this is a correct and safe way to transfer the salesrep
while (i.hasNext()) {
salesrep = (Salesrep)i.next();

The first comment is beacuse of the referential integrity . But doing that way , will throw an IllegalStateException . We should do the second way .
I think the same can be achieved using the following query
SELECT OBJECT(p) FROM Order o , IN(o.lineItems) l , Product p
Even that looks wrong . As the spec on page232 says that,"The SELECT clause must not use the OBJECT operator to qualify path expressions."
So ,
select Object(l.product) from Order o , IN (o.lineItems) l
is also not valid . So , Its true that Kathys book is right . On page 406 , she says that select clause cant be used to return CMR fields.(because CMRfiled is an entity bean by itself , u have to use Object to return that . and the page 232 of the spec says that slect clause must not use OBJECT operator to qualify path expressions .ie since ,l.product is a path expression , we cant use OBJECT to qualify that for select clause).
Any thing went wrong in my explonation ?
Looks like , though EJB-QL is a small chapter and concept , there are around 5 questions in the exam . So , better prepare well for that and put more questions on the forum .
Ramakrishna R Allam ,
SCJP-95% , SCWCD-96%
Hi Cyril,
It doesnt look like product, in the following query is a CMR field .
SELECT l.product FROM Order AS o, IN(o.lineItems) l
Though the spec says that product is a CMR field on page 221 , in the example it doesnt look like one. As far as my understanding goes , if u return a beans component interface or a collection of such in the ejbSelect methods , u should have used Object as follows.
SELECT Object(l.product) FROM Order AS o, IN(o.lineItems) l
please guys , correct me if iam wrong .
I havent gone thru ur code fully . But , page 494 of the spec says that "An enterprise Bean must not use the AWT functionality to attempt to output information to a display, or to input information from a keyboard."
Hi Constantino,
I got this doubt earlier and got clarified in this forum only . SO , I will be enlightening u this time , thanks to my great helping nature :-)(just kidding) . EJB spec on page 81 says that , "Accessing resource managers and enterprise beans is disallowed in the session bean methods for which the Container does not have a meaningful transaction context or client security context." . Observe the OR part as well , "client security context" . ejbCreate() , ejbRemove() , ejbActivate() and ejbPassivate() [4 methods] have client security conetxt though they do not have the transaction context.(that is the reason why we can call gerCallerPrincipa and isCallerInRole() in those methods) .So , we can access resource mgrs and other enterprise beans as well in those 4 methods. But only in case of SFSB . In case of SLSB , we have neither transaction context nor security context . So , we can not access resource mgrs and other beans .
If this is the case, i have got another doubt which hasnt been clarified . afterCompletion in CMT stateful method , though doesnt have transaction context , has a security conetext . But surprisingly, it doesnt have access to resource managers and other enterprise beans . If u understand why , please let me know.
Hi Chung,I think its true for irrespective of the statefull ness of the bean (its true for both stateful and stateless beans) .And , all the create methods in remote homes muct throw CreateException. Isnt it?
Thanks very much . Its a great point . I could not observe that . Looks like i need to see everything very clearly .
yeah....U are right.
Infact ejbCreate() , ejbRemove() of both SFSB , SLSB are not in transaction context. So , setRollbackOnly and getRollbackOnly()(for CMT beans) methods cann not be accessed (in both SFSb and SLSB). this is true for ejbActivate() and ejbPassivate() methods of SFSB .
But in all the cases , if the bean is a BMT one , its possible to call the getUserTransaction() method in all the methods .(I do not undertsand why!!.When there is no transaction context running , (infact) when an unspecified tranction context is running , will it be possible to call getUserTransaction[ofcourse in BMT]). If that is the case , EJB spec should be right for the above Q'n . i.e getUserTransaction can be called from stateless ejbCreate and ejbRemove . Somebody please explain . this is really confusing .
The relationsships are defined only in EJB spec 2.0 and not earlier .. And they are only for CMP . not for BMP . The the target of a relationship- should be a CMP and should define local interfaces (both home and remote , though it can define remote interfaces as well).
I think we can do both the ways as everybody know . But It might be more appropriate to do it in the setXXXContext() methods . I remember i read some where in the spec , that we will write code that required for the life time of the bean in setXXContext() methods . But I read that for entity beans . Should be same for session as well as MDB . Any comments?