mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-15 12:15:50 +00:00
fixed naming issue in vet list
This commit is contained in:
parent
47ddd6f934
commit
0e60b03708
4 changed files with 7 additions and 5 deletions
|
@ -7,6 +7,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.JoinTable;
|
||||
import javax.persistence.ManyToMany;
|
||||
|
@ -27,7 +28,8 @@ import org.springframework.beans.support.PropertyComparator;
|
|||
@Entity @Table(name="vets")
|
||||
public class Vet extends Person {
|
||||
|
||||
@ManyToMany @JoinTable (name="vet_specialties",joinColumns = @JoinColumn(name = "vet_id"),
|
||||
@ManyToMany(fetch=FetchType.EAGER)
|
||||
@JoinTable (name="vet_specialties",joinColumns = @JoinColumn(name = "vet_id"),
|
||||
inverseJoinColumns= @JoinColumn(name = "specialty_id"))
|
||||
private Set<Specialty> specialties;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class VetController {
|
|||
Vets vets = new Vets();
|
||||
vets.getVetList().addAll(this.clinicService.findVets());
|
||||
model.addAttribute("vets", vets);
|
||||
return "vets/vetsList";
|
||||
return "vets/vetList";
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
<tbody>
|
||||
<c:forEach var="vet" items="${vets.vetList}">
|
||||
<tr>
|
||||
<td>${vet.firstName} ${vet.lastName}</td>
|
||||
<td><c:out value="${vet.firstName} ${vet.lastName}" /></td>
|
||||
<td>
|
||||
<c:forEach var="specialty" items="${vet.specialties}">
|
||||
${specialty.name}
|
||||
<c:out value="${specialty.name}" />
|
||||
</c:forEach>
|
||||
<c:if test="${vet.nrOfSpecialties == 0}">none</c:if>
|
||||
</td>
|
|
@ -56,7 +56,7 @@
|
|||
<!-- - The AtomView rendering a Atom feed of the visits -->
|
||||
<bean id="visitList" class="org.springframework.samples.petclinic.web.VisitsAtomView"/>
|
||||
|
||||
<bean id="vets/vetsList" class="org.springframework.web.servlet.view.xml.MarshallingView">
|
||||
<bean id="vets/vetList" class="org.springframework.web.servlet.view.xml.MarshallingView">
|
||||
<property name="marshaller" ref="marshaller"/>
|
||||
</bean>
|
||||
|
||||
|
|
Loading…
Reference in a new issue