Given:
<code>
Person
public Person(int id)
public int getid()
public String getContactDetails()
public void setContactDetails(String contactDetails)
public String getName()
public void setName(String name)
public Person getPerson(int id) throws Exception
public void createPerson(int id) throws Exception
public Person deletePerson(int id) throws Exception
public void updatePerson(Person p) throws Exception
</code>
Which group of methods is moved to a new class when implementing the DAO pattern?
A.
public int getId ()
public String getContractDetails ()
public void setContactDetails (String ContactDetails)
public void getName ()
public Person setName (String name)
B.
public int getId ()
public String getContractDetails ()
public void getName ()
public person getPerson (int id) throws Exception
C.
public void setContactDetails(String contactDetails)
public void setName (String name)
D.
public person getPerson(int id) throws Exception
public void createPerson (person p) throws exception
public void deleteperson(int id) throws Exception
public void updatePerson (Person p) throws Exception
Explanation:
We move the most abstract highest level methods into a separate class.
Note:Data Access Object
Abstracts and encapsulates all access to a data source
Manages the connection to the data source to obtain and store data
Makes the code independent of the data sources and data vendors (e.g. plain-text, xml, LDAP,MySQL, Oracle, DB2)