Java EJB Quiz
Test your knowledge of Enterprise JavaBeans including session beans, entity beans, message-driven beans, EJB Query Language, and deployment configuration.
Questions
What type of enterprise bean is used to embody application processing state information?
- javax.ejb.EnterpriseBean
- javax.ejb.SessionBean
- javax.ejb.MessageBean
- javax.ejb.EntityBean
Which interfaces must be implemented by Message driven beans? (3 correct answers)
- javax.ejb.MessageDrivenBean
- java.io.Serializable
- javax.enterprise.deploy.model.J2eeApplicationObject
- javax.jms.MessageListener
- javax.ejb.EJBException
Which methods should NOT be defined inside the home interface of a session bean? (2 correct answers)
- find methods
- multiple create() methods
- business methods
- remove() methods
The persistence of Person and Address information in an application is implemented via BMP entity beans. Each Person must have exactly one Address. If a Person contains the primary key for Address in a persistent field, how should you implement the Person
- The ejbRemove() method of Person invokes the remove() method of Address.
- The ejbStore() method of Person invokes the ejbStore() method of Address.
- The ejbPassivate() method of Person invokes the ejbPassivate() method of Address.
- The ejbLoad() method of Person invokes the findByPrimaryKey() method of Address-Home.
- The ejbLoad() method of Person invokes the ejbLoad() method of Address.
Before a message-driven bean (MDB) can be tested, the J2EE application server has been installed on a test machine and a connection factory and destination have been configured for the JMS provider. What other configuration task MUST be completed before t
- The native library directory in the classpath must be specified
- A message listener port must be defined
- The message listener service must be enabled
- A message passivation directory must be specified
A course enrolment application needs to define a JDBC resource reference for a DB2 database in the deployment descriptor. Assuming that the name of the resource reference is "enrolment", what is the appropriate JNDI declaration?
- java:comp/env/jdbc/db2/enrolment
- java:comp/env/jdbc/enrolment
- java:comp/env/enrolment
- java:jdbc/env/db2/enrolment
The EJB Query Language is used
- to enhance the SQL96 standard with additional options for complex relationships
- instead of the findByPrimaryKey() method, to define alternative selection criteria
- to specify a concrete implementation for the find and select methods of CMP entity beans
- for accessing User Defined data types and Stored Procedures in the database.
Container managed transactions are defined via trans-attributes in the deployment descriptor. When a session bean demarcates the transaction and calls an Entity Bean, what is the best transactional setting for the Entity Bean?
- Supports
- Never
- Required
- RequiresNew
When a packaged enterprise application (EAR file) is deployed to the application server, which activities can be performed? (2 correct answers)
- Specify the "context root" for each web application
- Generate access beans for any enterprise beans
- Assign alias names to the attributes of the Entity beans
- Map the Entity beans’ attributes to the relational database tables
What isnottrue of a Java bean?
- There are no public instance variables.
- All persistent values are accessed using getxxxand setxxxmethods.
- It may have many constructors as necessary.
- All of the above are true of a Java bean.