  | 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
|
|
|
  | | | Designing BusinessObjects (again) [Was Confusion with BusinessObject impleme | Designing BusinessObjects (again) [Was Confusion with BusinessObject impleme 2004-08-26 - By Bayarsaikhan VOLODYA (YAZ-ArGe)
Back Good job.
i don't use any application server, so EJB logic is far away from me. According to me, there should be UserDAOFactory (not userfactory) otherwise for every user that we created, we should call setDAO method and there will be so many references to UserDAO. UserDAOFactory is singleton, return UserDAO which have create(UserPK pk), findByPrimaryKey(UserPK pk), blah blha
user shouldnot update, create, delete itself. because it is not Information Expert of itself. UserDAOFactory (as yours UserFactory) is reponsible for User.
This is only my opinion. if i am wrong, let me know and lead me to right way.
Bayarsaikhan VOLODYA
// creating a new user UserData data = // populate data UserFactory uf = // get user factory User user = uf.create(data);
// Finding a user UserPK pk = // populate user primary key UserFactory uf = // get user factory User user = uf.findByPrimaryKey(pk);
// Updating a user UserData data = // populate data from user input UserFactory uf = // get user factory UserPK pk = // populate user primary key User user = uf.findByPrimaryKey(pk); user.copy(data); // disallows modification of user identity user.update();
-- --Original Message-- -- From: Robert Taylor [ <mailto:rtaylor@(protected)> mailto:rtaylor@(protected) .COM] Sent: Thursday, August 26, 2004 2:55 PM To: J2EEPATTERNS-INTEREST@(protected) Subject: Designing BusinessObjects (again) [Was Confusion with BusinessObject implementations]
Sorry for returning to this subject as I know I've already posted about it but I've done a lot of reading and asking questions and have worked through several implementations and think I have finally come to a sound solution. I have a complete explanation along with UML, ER diagram, and pseudo-code posted here:
<http://bellsouthpwp.net/r/o/robertkaren6465/pages/java/bo/> http:/ /bellsouthpwp.net/r/o/robertkaren6465/pages/java/bo/
I'ld be very grateful for any feedback, comments or constructive critigue and welcome any questions.
robert
==================================================================== Companion Site: <http://www.corej2eepatterns.com> http://www.corej2eepatterns .com J2EE BluePrints: <http://java.sun.com/blueprints/corej2eepatterns> http://java .sun.com/blueprints/corej2eepatterns List Archive: <http://archives.java.sun.com/archives/j2eepatterns-interest .html> http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859 (See http://iso-8859.ora-code.com)-1"> <TITLE></TITLE>
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD> <BODY> <P><FONT size=2>Good job.</FONT></P> <P><FONT size=2><BR>i don't use any application server, so EJB logic is far away from me.<BR>According to me, there should be UserDAOFactory (not userfactory)<BR>otherwise for every user that we created, we should call setDAO method and there will be so many references to UserDAO.<BR>UserDAOFactory is singleton, return UserDAO which have <STRONG>create(UserPK pk), findByPrimaryKey(UserPK pk), blah blha</STRONG></FONT></P> <P><FONT size=2>user shouldnot update, create, delete itself. because it is not Information Expert of itself. UserDAOFactory (as yours UserFactory) is reponsible for User. </FONT></P> <P><FONT size=2>This is only my opinion. if i am wrong, let me know and lead me to right way.</FONT></P> <P><FONT size=2>Bayarsaikhan VOLODYA</FONT></P> <P><FONT size=2><FONT face=Arial color=#0000ff></FONT><BR><BR>// creating a new user<BR>UserData data = // populate data<BR>UserFactory uf = // get user factory<BR>User user = uf.create(data);<BR><BR>// Finding a user<BR>UserPK pk = // populate user primary key<BR>UserFactory uf = // get user factory<BR>User user = uf.findByPrimaryKey(pk);<BR><BR>// Updating a user<BR>UserData data = // populate data from user input<BR>UserFactory uf = // get user factory<BR>UserPK pk = // populate user primary key<BR>User user = uf.findByPrimaryKey(pk);<BR>user.copy(data); // disallows modification of user identity<BR>user.update();<BR><BR><BR>-- --Original Message-- --<BR>From: Robert Taylor [</FONT><A href="mailto:rtaylor@(protected)"><FONT size=2>mailto:rtaylor@(protected)</FONT></A><FONT size=2>]<BR>Sent: Thursday, August 26, 2004 2:55 PM<BR>To: J2EEPATTERNS-INTEREST@(protected)<BR>Subject: Designing BusinessObjects (again) [Was Confusion with BusinessObject implementations]<BR><BR><BR>Sorry for returning to this subject as I know I've already posted<BR>about it but I've done a lot of reading and asking questions and<BR>have worked through several implementations and think I have finally<BR>come to a sound solution. I have a complete explanation along with<BR>UML, ER diagram, and pseudo-code posted here:<BR><BR></FONT><A href="http://bellsouthpwp.net/r/o/robertkaren6465/pages/java/bo/" target=_blank><FONT size=2>http://bellsouthpwp.net/r/o/robertkaren6465/pages/java/bo/</FONT></A><BR ><BR><BR><FONT size=2>I'ld be very grateful for any feedback, comments or constructive<BR>critigue and welcome any questions.<BR><BR>robert<BR><BR>=============================================== =====================<BR>Companion Site: </FONT><A href="http://www.corej2eepatterns.com" target=_blank><FONT size=2>http://www.corej2eepatterns.com</FONT></A><BR><FONT size=2>J2EE BluePrints: </FONT><A href="http://java.sun.com/blueprints/corej2eepatterns" target=_blank><FONT size=2>http://java.sun.com/blueprints/corej2eepatterns</FONT></A><BR><FONT size=2>List Archive: </FONT><A href="http://archives.java.sun.com/archives/j2eepatterns-interest.html" target=_blank><FONT size=2>http://archives.java.sun.com/archives/j2eepatterns-interest.html</FONT>< /A><BR><FONT size=2>Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)<BR></P></FONT></BODY></HTML> ==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
|
|
 |