|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 PetType s from the data store. |
java.util.Collection<Vet> |
getVets()
Retrieve all Vet s 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 SimpleJdbcClinicMBean
org.springframework.dao.DataAccessException
Clinic.getVets()
@Transactional(readOnly=true) public java.util.Collection<Vet> getVets() throws org.springframework.dao.DataAccessException
Clinic
Vet
s from the data store.
getVets
in interface Clinic
Collection
of Vet
s
org.springframework.dao.DataAccessException
@Transactional(readOnly=true) public java.util.Collection<PetType> getPetTypes() throws org.springframework.dao.DataAccessException
Clinic
PetType
s from the data store.
getPetTypes
in interface Clinic
Collection
of PetType
s
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 Clinic
lastName
- Value to search for
Collection
of matching Owner
s
(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 Clinic
id
- 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
Clinic
Pet
from the data store by id.
loadPet
in interface Clinic
id
- 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
Clinic
Owner
to the data store, either inserting or updating it.
storeOwner
in interface Clinic
owner
- the Owner
to save
org.springframework.dao.DataAccessException
BaseEntity.isNew()
@Transactional public void storePet(Pet pet) throws org.springframework.dao.DataAccessException
Clinic
Pet
to the data store, either inserting or updating it.
storePet
in interface Clinic
pet
- the Pet
to save
org.springframework.dao.DataAccessException
BaseEntity.isNew()
@Transactional public void storeVisit(Visit visit) throws org.springframework.dao.DataAccessException
Clinic
Visit
to the data store, either inserting or updating it.
storeVisit
in interface Clinic
visit
- the Visit
to save
org.springframework.dao.DataAccessException
BaseEntity.isNew()
public void deletePet(int id) throws org.springframework.dao.DataAccessException
Clinic
Pet
from the data store.
deletePet
in interface Clinic
org.springframework.dao.DataAccessException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |