  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | JSP - A mailing list about Java Server Pages specification and reference | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | persisting a domain object | persisting a domain object 2005-02-09 - By Robert Taylor
Back Greetings,
I was just curious which method of the 2 listed below is most used for managing persistence for domain objects:
1. ActiveRecord: http://www.martinfowler.com/eaaCatalog/activeRecord.html
Example: Person p = new Person(); p.setName("Mr. Person"); p.store();
Person p = Person.getPerson(personId);
p.setName("Mr. Parson"); p.store();
Person would use a Data Access Object to assist in persisting and accessing state.
2. Separate Domain Object, Data Access Object, Manager Object The Domain Object is a JavaBean presenting a domain entity like Person, Address, Item. The Data Access Object is responsible for mapping that Domain Object The Domain Manager Object is a proxy for the Data Access Object providing uniform functionality across possible multiple Data Access Object implementations
Example: Person p = new Person(); p.setName("Mr. Person"); PersonManager pm = // get PersonManager pm.store(p);
Person p = pm.getPerson(personId); p.setName("Mr. Parson"); pm.store(p);
PersonManager uses a Data Access Object to assist in persisting and accessing state for the Person.
/robert
=========================================================================== To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help".
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas -microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">
<head> <meta http-equiv=Content-Type content="text/html; charset=us-ascii"> <meta name=Generator content="Microsoft Word 11 (filtered medium)"> <style> <!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0in; margin-bottom:.0001pt; font-size:12.0pt; font-family:"Times New Roman";} a:link, span.MsoHyperlink {color:blue; text-decoration:underline;} a:visited, span.MsoHyperlinkFollowed {color:purple; text-decoration:underline;} span.EmailStyle17 {mso-style-type:personal-compose; font-family:Arial; color:windowtext;} @(protected) Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in;} div.Section1 {page:Section1;} /* List Definitions */ @(protected) l0 {mso-list-id:28842445; mso-list-template-ids:-24762948;} @(protected) l1 {mso-list-id:1295022432; mso-list-type:hybrid; mso-list-template-ids:499949942 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;} @(protected) l1:level1 {mso-level-tab-stop:.5in; mso-level-number-position:left; text-indent:-.25in;} @(protected) l1:level2 {mso-level-tab-stop:1.0in; mso-level-number-position:left; text-indent:-.25in;} @(protected) l1:level3 {mso-level-tab-stop:1.5in; mso-level-number-position:left; text-indent:-.25in;} @(protected) l1:level4 {mso-level-tab-stop:2.0in; mso-level-number-position:left; text-indent:-.25in;} @(protected) l1:level5 {mso-level-tab-stop:2.5in; mso-level-number-position:left; text-indent:-.25in;} @(protected) l1:level6 {mso-level-tab-stop:3.0in; mso-level-number-position:left; text-indent:-.25in;} @(protected) l1:level7 {mso-level-tab-stop:3.5in; mso-level-number-position:left; text-indent:-.25in;} @(protected) l1:level8 {mso-level-tab-stop:4.0in; mso-level-number-position:left; text-indent:-.25in;} @(protected) l1:level9 {mso-level-tab-stop:4.5in; mso-level-number-position:left; text-indent:-.25in;} ol {margin-bottom:0in;} ul {margin-bottom:0in;} --> </style>
</head>
<body lang=EN-US link=blue vlink=purple>
<div class=Section1>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>Greetings, <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>I was just curious which method of the 2 listed below is most used for managing persistence for domain objects:<o :p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p>
<ol style='margin-top:0in' start=1 type=1> <li class=MsoNormal style='margin-bottom:12.0pt;mso-list:l1 level1 lfo3'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial' >ActiveRecord: <br> <a href="http://www.martinfowler.com/eaaCatalog/activeRecord.html">http:/ /www.martinfowler.com/eaaCatalog/activeRecord.html</a><br> <br> Example:<br> Person p = new Person();<br> p.setName(“Mr. Person”);<br> p.store();<br> <br> Person p = Person.getPerson(personId);<br> <br> p.setName(“Mr. Parson”);<br> p.store();<br> <br> Person would use a Data Access Object to assist in persisting and accessing state.<br> <br> <br> <br> <o:p></o:p></span></font></li> <li class=MsoNormal style='mso-list:l1 level1 lfo3'><font size=2 face=Arial> <span style='font-size:10.0pt;font-family:Arial'>Separate Domain Object, Data Access Object, Manager Object<br> The Domain Object is a JavaBean presenting a domain entity like Person, Address, Item.<br> The Data Access Object is responsible for mapping that Domain Object<br> The Domain Manager Object is a proxy for the Data Access Object providing uniform <br> functionality across possible multiple Data Access Object implementations <br> <br> Example:<br> Person p = new Person();<br> p.setName(“Mr. Person”);<br> PersonManager pm = // get PersonManager<br> pm.store(p);<br> <br> Person p = pm.getPerson(personId);<br> p.setName(“Mr. Parson”);<br> pm.store(p);<o:p></o:p></span></font></li> </ol>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal style='margin-left:.5in'><font size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'>PersonManager uses a Data Access Object to assist in persisting and accessing state<br> for the Person.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'>/robert<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt; font-family:Arial'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size: 12.0pt'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size: 12.0pt'><o:p> </o:p></span></font></p>
</div>
</body>
</html> =========================================================================== To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help". <p>
|
|
 |