public class HibernateContactDao extends Object implements ContactDao
ContactDao
.Constructor and Description |
---|
HibernateContactDao() |
Modifier and Type | Method and Description |
---|---|
protected org.hibernate.Query |
buildFindQuery(QueryParam qp,
Contact filter,
boolean count)
builds a query object to satisfy the provided parameters
|
int |
count(Contact filter)
Return the number of Contacts in the DB.
|
void |
delete(long id)
Delete a
Contact from the DB, given it's id. |
Iterator<Contact> |
find(QueryParam qp,
Contact filter)
Query the DB, using the supplied query details.
|
protected org.hibernate.Session |
getSession()
Helper method for retrieving hibernate session
|
List<String> |
getUniqueLastNames()
Returns a list of unique last names
|
Contact |
load(long id)
Load a
Contact from the DB, given it's id . |
Contact |
save(Contact contact)
Save the contact to the DB
|
void |
setSessionFactory(org.hibernate.SessionFactory factory)
Setter for session factory.
|
public void setSessionFactory(org.hibernate.SessionFactory factory)
factory
- hibernate session factoryprotected org.hibernate.Session getSession()
public Contact load(long id)
Contact
from the DB, given it's id .load
in interface ContactDao
id
- The id of the Contact to load.public Contact save(Contact contact)
save
in interface ContactDao
contact
- public void delete(long id)
Contact
from the DB, given it's id.delete
in interface ContactDao
id
- The id of the Contact to delete.public Iterator<Contact> find(QueryParam qp, Contact filter)
find
in interface ContactDao
qp
- Query Parameters to use.public int count(Contact filter)
count
in interface ContactDao
public List<String> getUniqueLastNames()
getUniqueLastNames
in interface ContactDao
protected org.hibernate.Query buildFindQuery(QueryParam qp, Contact filter, boolean count)
qp
- sorting and paging criteriafilter
- filter criteriacount
- true if this is a query meant to retrieve the number of rowsCopyright © 2015. All rights reserved.