Question: Consider the class shown in the below Figure 4 and complete the missing code in the below class called MockTest.java. Instantiate the course object, set

  1. Consider the class shown in the below Figure 4 and complete the missing code in the below class called MockTest.java. Instantiate the course object, set the values as Course (ITSW3101, Application Software Development, 3 and FALL20) and save the object to the database. Use the persistence unit name as FL20_PU:

Figure 4

Solution:

public class MockTest {

public static void main(String[] args) {

}

}

  1. Write the appropriate annotations to turn the below MyEJBBean EJB in such a way that it can have only one instance per application. Also, which annotation you can apply to the below bean so that it will obtain an exclusive lock to the calling client and prevents all other clients from accessing all methods of the bean.

public class MyEJBBean {

public String getProductDetails(){

return "Return name from Database";

}

public void addProductDetails(String){

// code that save the name to Database

}

}

Solution:

public class MyEJBBean {

public String getProductDetails(){

return "Return name from Database";

}

public void addProductDetails(String){

// code that save the name to Database

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!