Thursday, 1 September 2011

Master Detail

Nothing more than /object1/{object1.id}/object2/{object2.id}
url="{ownerId}/pets/{petId}/edit"

[c:forEach var="pet" items="${owner.pets}">
...
[c:forEach var="visit" items="${pet.visits}">

TABLE: owners
PRIMARY KEY id

TABLE: pets
PRIMARY KEY id
FOREIGN KEY owner_id references the owners table id field

TABLE: visits
PRIMARY KEY id
FOREIGN KEY pet_id references the pets table id field


(1)Database
Like, TABLE: owners
PRIMARY KEY id

TABLE: types
PRIMARY KEY id

TABLE: pets
PRIMARY KEY id
FOREIGN KEY type_id references the types table id field
FOREIGN KEY owner_id references the owners table id field

(2)Business Layer
Like, Entity or Validation
...petclinic.Owner
...validation.OwnerValidator

(3)Business + Persistence Layer (ApplicationContext-jpa.xml)
Like, JPA Clinic Implementation
...jpa.EntityManagerClinic
JPA configuration is provided by orm.xml & persistence.xml

(4)Presentation Layer (controller)
web.xml & petclinic-servlet.xml





No comments:

Post a Comment