JavaDeploy
SiteMap
JSP - Servlets
JDBC
EJB Concepts
Entity Beans
Entity Beans
«Prev
Next»
Entity Beans
EJB Distributed Transactions
Overview EJB Transactions
Transactions Remote Objects
Management Distributed Transactions
Java Transaction API
Client Managed Transaction
Container Managed Transactions
Bean interactions Transaction Controls
EJB Transaction Exception
Choosing Differen Management Schemes
Entity Bean Components
Entity Bean Architecture
Primary Key Object Identity
Locating Entity Bean
Container Managed Persistence
Entity Bean Life Cycle
Client View Bean
Creating Entity Instance
Find Bean using Key
Comparing Entity Instances
Entity Bean Client Conclusion
Bean Managed Persistence
Entity Bean Clients - Quiz Results
The correct answers are indicated below, along with text that explains the correct answers.
1.
Which of the following statements are true for the
findByPrimaryKey()
method?
Please select all the correct answers.
A.
The return is the home interface.
B.
It takes a single argument, which is a class in the java.lang package.
C.
It finds the data and associates it with a bean instance.
D.
It creates an EJBObject associated with the primary key.
You selected:
none
The correct answers are C and D.
C is correct because the data is found using the primary key and the bean instance is created.
D is correct because the bean creates the EJBObject and associates it with the primary key. The remote reference to the EJBObject is returned from the
findByPrimaryKey()
. This makes answer A incorrect. In addition, you also need the home interface to access the method. B is incorrect because the primary key can be any class, as long as it is RMI IIOP compliant. It is not limited to being a class in the java.lang package.
2.
Which of the following statements are true for the
create()
method?
Please select all the correct answers.
A.
It returns a remote reference to the EJBObject of the created bean.
B.
It creates both the instance and the underlying data.
C.
It throws the NoSuchObjectException if the arguments cannot map to a single data entity.
D.
It takes multiple arguments that map to a single underlying data entity.
E.
There can be 0 or more create methods.
You selected:
none
The correct answers are A, B, D, and E.
A is correct because the
create()
method does return a remote reference that allows access to the business methods. B is correct as the instance is created, perhaps from the pool. C is incorrect because the bean instance will throw this exception only from the
findByPrimaryKey(),
which is looking up a specific piece of data. D is correct because create can take one or more arguments. E is correct because there can be 0 or more
create()
methods. If there are no
create()
methods, then the instance will only map to data that already exists.
Retake - Quiz