The course is part of this learning path
In this course, we will learn the concepts of Java EE 7 with a focus on Enterprise Java Beans (EJB).
Learning Objectives
- Enterprise Java Beans (EJB)
Intended Audience
- Anyone looking to get Oracle Java Certification
- Those who want to improve Java 7 EE knowledge
- Java developers
Prerequisites
- Have at least 2 years of Java development experience
Hello, dear friends. We have now completed this topic. To learn more, we will now begin to answer some questions about this topic. Let's begin with the first question. Serengeti trading company is starting to develop a new system that allows its participants residing anywhere in the world to buy and sell products in an auction style. The Serengeti's primary aim is to ensure that all participants are treated absolutely equally in all respects. This includes allocating resources to each participant, so that they do not affect each other. The Serengeti has enough funds to procure whatever it takes in the tech budget to achieve its goal. Which of the options and solutions would you recommend?
Stateless session beans as SLSB, message driven beans as MDB, BMP entity beans, Stateful session beans as SFSB. These do not solve the main purpose of allocating resources to a user. Stateful session cores allow a Java EE application to access and retain resources for a user for the lifetime of their session. So, the correct answer is D. Go on to the next question. An example application needs to read messages from a JMS queue, call a web service using the data provided in the same message and pass the data from the web service feedback into a database table. What kind of EJB should you use for this? Message driven bean, stateful session bean, Stateless session bean, Entity class. These other options cannot read a synchronously from a JMS queue. But they can be invoked by a message driven bean to execute the required work. The message oriented bean reads from a JMS queue and starts the job. So, the answer is A.
Let's solve the next question. If you are going to follow best practices and best practices for the java EE architecture, where would you place the business rules and usability accordingly? Servlets and web services are not architecturally best practice places for business rules and functionality. Enterprise beans are the architectural best practice position for business rules and functionality. So, the answer is B. Go on to the next question. Which of the following options would you recommend for the logic of operation for a highly accessible complex transaction system? Let's look at the options. Use JPA. Use a web centric architecture. Use stateful session beans. Use session beans with JPA. A web centric approach basically means no transactional support. JPA by itself does not provide transaction support. The need for stateful architecture is not mentioned. So, there is no need for stateful session calls. Session beans with JPA have the required processing support. So, the answer is D. Go on to the next question. If you are designing an application that will be used by a large number of users, which of the following types of EJBs should you avoid as much as possible? Stateful session beans as SFSB. Stateless session beans as SLSB. Message driven bean as MDB. Entity bean. The EJB container needs a stateful session bean instance for every concurrent user. So, such resource intensive cores should be avoided unless the requirements are strictly necessary. So, the answer is A. Go on to the next question. ABC Corp is a small B2C reverse auction online business. You have been asked to recommend a persistent strategy for their new platform with a greenfield as there is no existing code or database schema project. The top priorities are ease of development and integration with EJB 3. What would you recommend on this subject? JPA offers the best integration with EJB 3 and was designed with ease of development in mind. So, the answer is D. Let's go on to the next question.
Which of the following is not considered a benefit of JPA persistence technology? Callable outside of the EJB container. Utilizes POJOs. Works with NoSQL data sources. Eliminates JNDI lookups. JPA does not work with NoSQL applications. So, the correct answer is C. Let's solve the next question. Which of the following options is not considered a benefit of CMP persistence technology? It takes less time to develop than others. Container generates SQL. Can be switched to JPA later on. Deeper knowledge of SQL is required. Deeper SQL knowledge is not required, but may be useful. So, the answer is D. Go on to the next question. You have been commissioned to advise a company with a view to making some of its existing EJB based business functions available to external customers for a fast approaching short term. What advice would you give if security was not taken into account? Create a java servlet that calls EJB. Create a JSP that calls EJB, expose an existing EJB as a web service. Create a JAX- WS web service that calls EJB. While approach B is not the wrong approach, the disregard for security combined with the time pressure to deliver makes it an inappropriate approach. A and D do not expose a web service interface, making an existing EJB available as a web service can be done quickly and is the best choice without security considerations. So, the answer is C. Let's go on to the next question. Which of the following options is a disadvantage of calling web services from an EJB component? It is against the preferred architectural approach.
It increases the validity of the data. Increased productivity, increased security. Calling a web service from an EJB component is considered against the preferred architectural approach of using an integration layer. So, the correct answer is A as it is against the preferred architectural approach. Go on to the next question. An existing application heavily uses EJB 2.0 CMP asset kernels. The app has no major issues in production and little development is planned for the future. You were asked to recommend a method to adopt when making minor changes to the application. What would you recommend on this subject? Let's look at the options. JPA entity classes. CMP entity beans. Use DAO accessing JDBC directly. DMP entity beans. DMP entity beans options introduce important new code that should be fully regression tested. For a very stable application that doesn't require a lot of new development, it's unwise to engage in significantly more development. It is a pragmatic approach to continue using the EJB 2.0 CMP asset cores. So, the answer is B. Let's go on to the next question. You are responsible for architecting a new Java EE application that executes data represented in java objects in a relational database. Which of the following options would you recommend? Use DAO accessing JDBC directly. JPA entity classes. DMP entity beans. CMP entity beans. The recommended approach is to use JPA entity classes for persistent Java objects in a relational database. So, the answer is B. We have now finished this topic. In the next video, we will start to examine a new topic. See you in the next video.
OAK Academy is made up of tech experts who have been in the sector for years and years and are deeply rooted in the tech world. They specialize in critical areas like cybersecurity, coding, IT, game development, app monetization, and mobile development.