Exam 1 Solution 072017 C
Exam 1 Solution 072017 C
Exam 1 Solution 072017 C
Enterprise Architecture
Midterm July 2017
Name________________________________________________
Student ID __________________________________________
NOTE: This material is private and confidential. It is the property of MUM and is not to be
disseminated.
1. [15 points] Circle which of the following is TRUE/FALSE concerning ORM technologies:
T F An example of impedance mismatch is the fact that a RDB puts information in rows and an OO
language puts information in Objects
EXPLAIN:____A RDB consists of individual columns which represent the fields/properties of an object.
This requires some way to BIND the DB data to the Object & make sure that the data types match.
T F A good use case for using an ORM is complex interactions between entities
EXPLAIN:__ This is a major advantage of an ORM. A RDB entity-entity relationship uses Foreign keys. The
ORM “automatically” maps these relationships, reducing boiler plate code.
T F The value of a good ORM is that it automatically takes care of all the issues relating to a RDB
EXPLAIN:__It is NOT possible for an ORM to do everything. It covers mapping and CRUD services. However
there are situations where “manual” intervention is necessary [e.g. custom SQL queries]
T F JPA is an industry standard for ORMs and has made Hibernate obsolete.
EXPLAIN:____JPA is an industry standard but does not replace Hibernate. In fact, Hibernate implements JPA
As JPA is “only” an API.
T F Native SQL Queries are supported by a good ORM solution and are recommended as the first choice
way to access entity relationships.
EXPLAIN:____Native queries are fallback mechanism to be used when queries are complex and cannot be
adequately implemented in JPQL.
2. [20 points] Annotate the Domain Objects based on the Domain Model and Entity Relationship Diagram
provided. NOTE: All the fields are not listed. Only annotate the fields that are listed.
Trip.java
TripCost.java
Payment.java
Member.java
3. [15 points] Transaction management is an important part of RDBMS oriented enterprise applications
Spring provides core functionality to assist in transaction management. Describe the Spring transaction
functionality, how it is implemented, how it facilitates ORM Transaction management. Include an
explanation on how it supports the RDBMS ACID properties of Consistency and Isolation. Be specific.
Give Examples.
ANSWER:
4. [15 points] For the following relationships implement a Batch fetch of all Trips with their Payments collection.
Assume the Payment collection is fetch LAZILY.
One fetch for ALL the Trips PLUS N Payment collection fetches where N is based on batch Size & # of Trips.
For example, 20 Trips with batch size = 2 results in 10 collection fetches.
For example, 20 Trips with batch size = 3 results in 7 collection fetches. [6 fetches of 3 PLUS 1 fetch of 2].
For example, 20 Trips with batch size = 4 results in 5 collection fetches, etc…
In TripServiceImpl.Java
In Trip.Java
The query looks up all Members[s] by email that has a Trip associated with it that has a Trip Cost
greater than the supplied amount value. Refer to Problem #2 for field names.
The Query should be a parameterized query. Also show the modifications to all classes in order to
adhere to the N-Tier architecture convention. Identify the specific packages that each modified class is
in.
edu.mum.dao.MemberDao
public Member findByEmailAndTotalCost(String email,Double amount);
edu.mum.dao.impl. MemberDaoImpl
edu.mum.service. MemberService
public Member findByEmailAndTotalCost(String email,Double amount);
edu.mum.service.impl.MemberService Impl
public Member findByEmailAndTotalCost(String email,Double amount) {
return memberDao.findByEmailAndTotalCost(email, amount);
}