public class SubjectDAOSpringJDBCImpl extends Object implements SubjectDAO
Constructor and Description |
---|
SubjectDAOSpringJDBCImpl() |
Modifier and Type | Method and Description |
---|---|
Long |
getSubjectIdByDescription(Subject subject)
Looks up a subject in the database by its description.
|
ArrayList |
getSubjects()
Retrieves all subjects from the database
|
Subject |
insert(Subject subject)
Inserts a subject into the database and updates the ID of the
input subject parameter.
|
void |
insertNewSubjectRecord(Subject subject)
Inserts a new subject record into the database, using description field
in subject input parameter.
|
void |
setInsertSubjectSQL(String insertSubjectSQL)
Used for Spring Dependency Injection
|
void |
setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
Used for Spring Dependency Injection
|
void |
setResourceBundleMessageSource(org.springframework.context.support.ResourceBundleMessageSource resourceBundleMessageSource)
Used for Spring Dependency Injection
|
void |
setSelectAllSubjectsSQL(String selectAllSubjectsSQL)
Used for Spring Dependency Injection
|
void |
setSelectSubjectOnDescriptionSQL(String selectSubjectOnDescriptionSQL)
Used for Spring Dependency Injection
|
void |
setSubjectIds(ArrayList subjects)
Walks input ArrayList, looking up and setting ID properties for
each Subject in the list.
|
public void setResourceBundleMessageSource(org.springframework.context.support.ResourceBundleMessageSource resourceBundleMessageSource)
public void setInsertSubjectSQL(String insertSubjectSQL)
public void setSelectAllSubjectsSQL(String selectAllSubjectsSQL)
public void setSelectSubjectOnDescriptionSQL(String selectSubjectOnDescriptionSQL)
public void setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
jdbcTemplate
- The jdbcTemplate to set.public Long getSubjectIdByDescription(Subject subject) throws LibraryException
getSubjectIdByDescription
in interface SubjectDAO
subject
- Subject instance whose (trimmed) description field is
used as the key in the lookupLibraryException
- if subject is null or has null descriptionpublic void insertNewSubjectRecord(Subject subject) throws LibraryException
subject
- The new Subject to insertLibraryException
- if required fields are missing or an SQL error
occurspublic Subject insert(Subject subject) throws LibraryException
insert
in interface SubjectDAO
subject
- The Subject to insertLibraryException
- if subject is null or has null description
or a database access error occurspublic ArrayList getSubjects() throws LibraryException
getSubjects
in interface SubjectDAO
LibraryException
public void setSubjectIds(ArrayList subjects) throws LibraryException
setSubjectIds
in interface SubjectDAO
subjects
- = ArrayList of SubjectsLibraryException
Copyright © 2003-2017 The Virtual Library Team. All Rights Reserved.