|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.samples.petclinic.jdbc.SimpleJdbcClinic
@Service @ManagedResource(value="petclinic:type=Clinic") public class SimpleJdbcClinic
A simple JDBC-based implementation of the Clinic interface.
This class uses Java 5 language features and the SimpleJdbcTemplate
plus SimpleJdbcInsert. It also takes advantage of classes like
BeanPropertySqlParameterSource and
ParameterizedBeanPropertyRowMapper which provide automatic mapping
between JavaBean properties and JDBC parameters or query results.
SimpleJdbcClinic is a rewrite of the AbstractJdbcClinic which was the base class for JDBC implementations of the Clinic interface for Spring 2.0.
| Constructor Summary | |
|---|---|
SimpleJdbcClinic()
|
|
| Method Summary | |
|---|---|
void |
deletePet(int id)
Deletes a Pet from the data store. |
java.util.Collection<Owner> |
findOwners(java.lang.String lastName)
Loads Owners from the data store by last name, returning
all owners whose last name starts with the given name; also loads
the Pets and Visits for the corresponding
owners, if not already loaded. |
java.util.Collection<PetType> |
getPetTypes()
Retrieve all PetTypes from the data store. |
java.util.Collection<Vet> |
getVets()
Retrieve all Vets from the data store. |
void |
init(javax.sql.DataSource dataSource)
|
Owner |
loadOwner(int id)
Loads the Owner with the supplied id; also loads
the Pets and Visits for the corresponding
owner, if not already loaded. |
Pet |
loadPet(int id)
Retrieve a Pet from the data store by id. |
void |
refreshVetsCache()
Refresh the cache of Vets that the Clinic is holding. |
void |
storeOwner(Owner owner)
Save an Owner to the data store, either inserting or updating it. |
void |
storePet(Pet pet)
Save a Pet to the data store, either inserting or updating it. |
void |
storeVisit(Visit visit)
Save a Visit to the data store, either inserting or updating it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SimpleJdbcClinic()
| Method Detail |
|---|
public void init(javax.sql.DataSource dataSource)
@ManagedOperation
@Transactional(readOnly=true)
public void refreshVetsCache()
throws org.springframework.dao.DataAccessException
refreshVetsCache in interface SimpleJdbcClinicMBeanorg.springframework.dao.DataAccessExceptionClinic.getVets()
@Transactional(readOnly=true)
public java.util.Collection<Vet> getVets()
throws org.springframework.dao.DataAccessException
ClinicVets from the data store.
getVets in interface ClinicCollection of Vets
org.springframework.dao.DataAccessException
@Transactional(readOnly=true)
public java.util.Collection<PetType> getPetTypes()
throws org.springframework.dao.DataAccessException
ClinicPetTypes from the data store.
getPetTypes in interface ClinicCollection of PetTypes
org.springframework.dao.DataAccessException
@Transactional(readOnly=true)
public java.util.Collection<Owner> findOwners(java.lang.String lastName)
throws org.springframework.dao.DataAccessException
Owners from the data store by last name, returning
all owners whose last name starts with the given name; also loads
the Pets and Visits for the corresponding
owners, if not already loaded.
findOwners in interface CliniclastName - Value to search for
Collection of matching Owners
(or an empty Collection if none found)
org.springframework.dao.DataAccessException
@Transactional(readOnly=true)
public Owner loadOwner(int id)
throws org.springframework.dao.DataAccessException
Owner with the supplied id; also loads
the Pets and Visits for the corresponding
owner, if not already loaded.
loadOwner in interface Clinicid - the id to search for
Owner if found
org.springframework.dao.DataRetrievalFailureException - if not found
org.springframework.dao.DataAccessException
@Transactional(readOnly=true)
public Pet loadPet(int id)
throws org.springframework.dao.DataAccessException
ClinicPet from the data store by id.
loadPet in interface Clinicid - the id to search for
Pet if found
org.springframework.dao.DataRetrievalFailureException - if not found
org.springframework.dao.DataAccessException
@Transactional
public void storeOwner(Owner owner)
throws org.springframework.dao.DataAccessException
ClinicOwner to the data store, either inserting or updating it.
storeOwner in interface Clinicowner - the Owner to save
org.springframework.dao.DataAccessExceptionBaseEntity.isNew()
@Transactional
public void storePet(Pet pet)
throws org.springframework.dao.DataAccessException
ClinicPet to the data store, either inserting or updating it.
storePet in interface Clinicpet - the Pet to save
org.springframework.dao.DataAccessExceptionBaseEntity.isNew()
@Transactional
public void storeVisit(Visit visit)
throws org.springframework.dao.DataAccessException
ClinicVisit to the data store, either inserting or updating it.
storeVisit in interface Clinicvisit - the Visit to save
org.springframework.dao.DataAccessExceptionBaseEntity.isNew()
public void deletePet(int id)
throws org.springframework.dao.DataAccessException
ClinicPet from the data store.
deletePet in interface Clinicorg.springframework.dao.DataAccessException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||