|
INTERVIEW QUESTIONS
J2EE
EJB
DETAILS
Question: When are CMP fields loaded? Is it always determined by the finders-load-bean setting? What is the default behavior?
Answer: A. Finders-load-bean is true by default. A bean is retrieved via a finder explicitly if you call a findXXX() method to get the bean and implicitly if you retrieve the bean via a cmr-field getXXX method. Either of these will result in eager loading of the bean's fields if finders-load-bean is true for the bean.
If you aren't calling a finder, but just accessing the bean via a reference you obtained in a different transaction, then fields are always loaded lazily when using 2.0 CMP, i.e. they aren't read from the DBMS during ejbLoad, but rather when a getXXX() method is called. By default there is a single field group that contains all the fields if you don't define any field groups. So, calling a cmp-field getXXX() method loads all of the persistent state of the bean by default.
|
|
|
Category |
EJB Interview Questions & Answers -
Exam Mode /
Learning Mode
|
Rating |
(0.3) By 7361 users |
Added on |
8/31/2014 |
Views |
71395 |
Rate it! |
|
|
Question:
When are CMP fields loaded? Is it always determined by the finders-load-bean setting? What is the default behavior?
Answer:
A. Finders-load-bean is true by default. A bean is retrieved via a finder explicitly if you call a findXXX() method to get the bean and implicitly if you retrieve the bean via a cmr-field getXXX method. Either of these will result in eager loading of the bean's fields if finders-load-bean is true for the bean.
If you aren't calling a finder, but just accessing the bean via a reference you obtained in a different transaction, then fields are always loaded lazily when using 2.0 CMP, i.e. they aren't read from the DBMS during ejbLoad, but rather when a getXXX() method is called. By default there is a single field group that contains all the fields if you don't define any field groups. So, calling a cmp-field getXXX() method loads all of the persistent state of the bean by default. Source: CoolInterview.com
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|
|
Related Questions |
View Answer |
|
Can an entity bean be a listener for JMS messages?
|
View Answer
|
|
How big should I make the cache for a stateful session bean?
|
View Answer
|
|
When should I use a Stateful session bean and when should I use a servlet session?
|
View Answer
|
|
What is the difference between the NRU and LRU cache?
|
View Answer
|
|
Why did I get a LockTimedOutException?
|
View Answer
|
|
Can you explain passivation / activation?
|
View Answer
|
|
When are ejbCreate and ejbRemove called on stateless EJBs?
|
View Answer
|
|
Can I call remove() on a stateless session bean?
|
View Answer
|
|
When are stateless EJBs passivated?
|
View Answer
|
|
How should I set initial-beans-in-free-pool for stateless beans?
|
View Answer
|
|
How should I set max-beans-in-free-pool for stateless beans?
|
View Answer
|
|
Q. Which versions of the EJB specification are supported by WebLogic Server?
|
View Answer
|
|
Q. Where can I get a copy of the EJB specification?
|
View Answer
|
|
Q. What is the free pool?
|
View Answer
|
|
Q. What is the free pool?
|
View Answer
|
|
Q. Must EJBs be homogeneously deployed across a cluster? Why?
|
View Answer
|
|
Q. Why is there no polymorphic-type response from a create() or find() method?
|
View Answer
|
|
Given the following files, write the client codes to locate/create/invoke a sessionBean in order to get the company name by using getCompanyName(). File: companyHome.java companyRemote.java companyBean.java - getCompanyName() JNDI Name: ejb/company
|
View Answer
|
|
Write a basic structure of an EJB session bean class.
|
View Answer
|
|
What are the design patterns in EJB? Clarify it?
|
View Answer
|