Exercise 12.1

  1. Identify the basic elements of object-oriented programming.

  2. Compare and contrast relations vs. objects.

Exercise 12.2

  1. Explain the concept of dependency injection.

  2. In the following code who is injecting what into whom ? when? why?

    @Stateless
    @Path("cpdb")
    public class CPDBResource {
        @PersistenceContext
        private EntityManager em;
    
        @GET
        @Path("person/{id}")
        @Produces(MediaType.APPLICATION_JSON)
        public Person getPerson(@PathParam("id") long id) {
            return em.find(Person.class, id);
        }
    }