25.12.2013 Views

Developer Notes - ITwelzel.biz

Developer Notes - ITwelzel.biz

Developer Notes - ITwelzel.biz

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

AddressDAO ret = null;<br />

try<br />

{<br />

conn = getDataSource().getConnection();<br />

ps = conn.prepareStatement(GET_ADDRESS_STATEMENT,<br />

ResultSet.TYPE_SCROLL_INSENSITIVE,<br />

ResultSet.CONCUR_READ_ONLY);<br />

ps.setString(1, addressID);<br />

rs = ps.executeQuery();<br />

if (rs.first())<br />

{<br />

ret = new HSQLDBAddressDAO(addressID, rs);<br />

}<br />

<strong>Developer</strong> <strong>Notes</strong><br />

}<br />

rs.close();<br />

ps.close();<br />

conn.close();<br />

return ret;<br />

}<br />

catch (SQLException se)<br />

{<br />

throw new DAOException("SQLException: " + se.getMessage());<br />

}<br />

protected CompanyDAO getCompany(String companyID)<br />

throws DAOException<br />

{<br />

Connection conn = null;<br />

PreparedStatement ps = null;<br />

ResultSet rs = null;<br />

CompanyDAO ret = null;<br />

try<br />

{<br />

conn = getDataSource().getConnection();<br />

ps = conn.prepareStatement(GET_COMPANY_STATEMENT,<br />

ResultSet.TYPE_SCROLL_INSENSITIVE,<br />

ResultSet.CONCUR_READ_ONLY);<br />

ps.setString(1, companyID);<br />

rs = ps.executeQuery();<br />

if (rs.first())<br />

{<br />

ret = new HSQLDBCompanyDAO(companyID, rs);<br />

}<br />

rs.close();<br />

ps.close();<br />

conn.close();<br />

return ret;<br />

}<br />

catch (SQLException e)<br />

{<br />

throw new DAOException("SQLException: " + e.getMessage());<br />

}<br />

}<br />

public Contact getContact(String personID,<br />

String addressID,<br />

52<br />

www.novell.com/appnotes

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!