|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.samples.petclinic.hibernate.HibernateClinic
@Repository @Transactional public class HibernateClinic
Hibernate implementation of the Clinic interface.
The mappings are defined in "petclinic.hbm.xml", located in the root of the class path.
Note that transactions are declared with annotations and that some methods contain "readOnly = true" which is an optimization that is particularly valuable when using Hibernate (to suppress unnecessary flush attempts for read-only operations).
Constructor Summary | |
---|---|
HibernateClinic(org.hibernate.SessionFactory sessionFactory)
|
Method Summary | |
---|---|
void |
deletePet(int id)
Deletes a Pet from the data store. |
java.util.Collection<Owner> |
findOwners(java.lang.String lastName)
Retrieve Owner s from the data store by last name,
returning all owners whose last name starts with the given name. |
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. |
Owner |
loadOwner(int id)
Retrieve an Owner from the data store by id. |
Pet |
loadPet(int id)
Retrieve a Pet from the data store by id. |
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 HibernateClinic(org.hibernate.SessionFactory sessionFactory)
Method Detail |
---|
@Transactional(readOnly=true) public java.util.Collection<Vet> getVets()
Clinic
Vet
s from the data store.
getVets
in interface Clinic
Collection
of Vet
s@Transactional(readOnly=true) public java.util.Collection<PetType> getPetTypes()
Clinic
PetType
s from the data store.
getPetTypes
in interface Clinic
Collection
of PetType
s@Transactional(readOnly=true) public java.util.Collection<Owner> findOwners(java.lang.String lastName)
Clinic
Owner
s from the data store by last name,
returning all owners whose last name starts with the given name.
findOwners
in interface Clinic
lastName
- Value to search for
Collection
of matching Owner
s
(or an empty Collection
if none found)@Transactional(readOnly=true) public Owner loadOwner(int id)
Clinic
Owner
from the data store by id.
loadOwner
in interface Clinic
id
- the id to search for
Owner
if found@Transactional(readOnly=true) public Pet loadPet(int id)
Clinic
Pet
from the data store by id.
loadPet
in interface Clinic
id
- the id to search for
Pet
if foundpublic void storeOwner(Owner owner)
Clinic
Owner
to the data store, either inserting or updating it.
storeOwner
in interface Clinic
owner
- the Owner
to saveBaseEntity.isNew()
public void storePet(Pet pet)
Clinic
Pet
to the data store, either inserting or updating it.
storePet
in interface Clinic
pet
- the Pet
to saveBaseEntity.isNew()
public void storeVisit(Visit visit)
Clinic
Visit
to the data store, either inserting or updating it.
storeVisit
in interface Clinic
visit
- the Visit
to saveBaseEntity.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 |