Constructor and Description |
---|
AuthorDAOSpringJDBCImpl() |
Modifier and Type | Method and Description |
---|---|
Long |
findAuthorByFirstLastName(Author author)
Finds the id of the given
Author object in the database,
using the firstName and lastName properties
to lookup the record. |
void |
insert(Author author)
Inserts the given author into the database.
|
void |
insertNewAuthor(Author author)
Insert a new Author into the DB.
|
void |
setAuthorIds(ArrayList authors)
Walks input ArrayList, looking up and setting ID properties for
each Author in the list.
|
void |
setInsertAuthorByFirstlastNameSQL(String insertAuthorByFirstlastNameSQL)
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 |
setSelectAuthorByFirstLastNameSQL(String selectAuthorByFirstLastNameSQL)
Used for Spring Dependency Injection
|
public void setSelectAuthorByFirstLastNameSQL(String selectAuthorByFirstLastNameSQL)
public void setInsertAuthorByFirstlastNameSQL(String insertAuthorByFirstlastNameSQL)
public void setJdbcTemplate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
jdbcTemplate
- The jdbcTemplate to set.public void setResourceBundleMessageSource(org.springframework.context.support.ResourceBundleMessageSource resourceBundleMessageSource)
public void insert(Author author) throws LibraryException
AuthorDAO
Inserts the given author into the database. Has the side effect of
setting the id
field of author
to the
sequentially generated ID of the new record.
First checks to see if an author with the same
firstName
and lastName
as author
exists. If so, no insert is performed; but author.id
is
updated to the id of the previously existing record.
insert
in interface AuthorDAO
LibraryException
- if a data access error occurspublic Long findAuthorByFirstLastName(Author author) throws LibraryException
AuthorDAO
Author
object in the database,
using the firstName
and lastName
properties
to lookup the record.findAuthorByFirstLastName
in interface AuthorDAO
author
- Author to lookup by nameLibraryException
public void insertNewAuthor(Author author) throws LibraryException
author
- author To be inserted in the DBLibraryException
public void setAuthorIds(ArrayList authors) throws LibraryException
AuthorDAO
setAuthorIds
in interface AuthorDAO
authors
- = ArrayList of AuthorsLibraryException
Copyright © 2003-2017 The Virtual Library Team. All Rights Reserved.