|
We use Hibernate here, it is extremely useful indeed. Anyone want to elaborate on the pros and cons of JDBC versus AS400File? Colin Williams <colin.williams@xxxxxxxxxxxx> Sent by: java400-l-bounces@xxxxxxxxxxxx 04/01/2005 11:23 Please respond to Java Programming on and around the iSeries / AS400 <java400-l@xxxxxxxxxxxx> To "'Java Programming on and around the iSeries / AS400'" <java400-l@xxxxxxxxxxxx> cc Subject RE: DAO design pattern Lim, Niall, And if you want to take this stuff even further, Use a framework such as Ibatis or Hibernate for your Object/Database mapping. Hard work initially, especially hibernate, but as your application gets complex, you do see the benefits cheers Colin.W http://as400blog.blogspot.com Extension 5800 Direct dial 0870 429 5800 -----Original Message----- From: Niall.Smart@xxxxxxxxxxxxxxx [mailto:Niall.Smart@xxxxxxxxxxxxxxx] Sent: 04 January 2005 10:59 To: Java Programming on and around the iSeries / AS400 Cc: java400-l-bounces+niall.smart=friendsfirst.ie@xxxxxxxxxxxx; Java Programming on and around the iSeries / AS400 Subject: Re: DAO design pattern Lim Create an interface which defines the data related operations independantly of any particular representation/access method (i.e., file/JDBC, etc) public interface SomeObjectDAO { public void create(SomeObject object) throws DAOException; public void delete(Integer objectID) throws DAOException; public SomeObject findByID(Integer objectID) throws DAOException; public List findByKeyword(String keyword) throws DAOException; } Then write an implementation of this interface using the JT/400 API: public class JT400SomeObjectDAO { public SomeObject findByID(Integer objectID) { AS400File file = .... SomeObject someObject = new someObject(); someObject.setFoo(file.readInteger()); return someObject; } // ... } And finally write a factory to create instances of SomeObjectDAO: public class SomeObjectDAOFactory { private static instance = new SomeObjectDAOFactory(); public static SomeObjectDAOFactory getInstance() { return instance; } public SomeObjectDAO newInstance() { return new JT400SomeObjectDAO(); } } You don't gave to use checked exceptions. A framework like spring can obviate the need for trivial factory objects. "Lim Hock-Chai" <Lim.Hock-Chai@xxxxxxxxxxxxxxx> Sent by: java400-l-bounces+niall.smart=friendsfirst.ie@xxxxxxxxxxxx 03/01/2005 18:40 Please respond to Java Programming on and around the iSeries / AS400 <java400-l@xxxxxxxxxxxx> To "Java Programming on and around the iSeries / AS400" <java400-l@xxxxxxxxxxxx> cc Subject DAO design pattern Anybody has a good example on how should I design my web application for any file access related transaction? I'm using struts to create this web apps. I just wonder when I'm in the Action Form and I need to do some edit/insert/update on a record in a file, what is the correct way to design this. I've read some article about DAO design pattern. If this is a good approach, can anybody provide some example. (Note: I'm using Tomcat4.1 and plan to use DBCP for connection pooling.) thanks. -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l. The information contained in this e-mail is confidential and may be privileged. It is intended only for the addressee(s) stated above. If you are not an addressee, any use, dissemination, distribution, publication, or copying of the information contained in this e-mail is strictly prohibited. Friends First Life Assurance Company Ltd is regulated by the Irish Financial Services Regulatory Authority. If you have received this e-mail in error, please immediately notify us by telephone at 353-1-6610600 or e-mail Helpdesk@xxxxxxxxxxxxxxx and delete the e-mail from your system. Thank you for your co-operation. Friends First Group, Cherrywood Business Park , Loughlinstown Dublin 18. This e-mail has been sent by a company of Bertram Group Ltd, whose registered office is 1 Broadland Business Park, Norwich, NR7 0WF. This message, and any attachments, are intended solely for the addressee and may contain privileged or confidential information. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. If you believe that you have received this email in error, please contact the sender immediately. Opinions, conclusions and statements of intent in this e-mail are those of the sender and will not bind a Bertram Group Ltd company unless confirmed in writing by a director independently of this message. Although we have taken steps to ensure that this email and any attachments are free from any virus, we advise that in keeping with good computing practice the recipient should ensure they are actually virus free. -- This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l. The information contained in this e-mail is confidential and may be privileged. It is intended only for the addressee(s) stated above. If you are not an addressee, any use, dissemination, distribution, publication, or copying of the information contained in this e-mail is strictly prohibited. Friends First Life Assurance Company Ltd is regulated by the Irish Financial Services Regulatory Authority. If you have received this e-mail in error, please immediately notify us by telephone at 353-1-6610600 or e-mail Helpdesk@xxxxxxxxxxxxxxx and delete the e-mail from your system. Thank you for your co-operation. Friends First Group, Cherrywood Business Park , Loughlinstown Dublin 18.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.