× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Please note that I'm a beginner java programmer.  So, here I go.

I'm assuming that JT400SomeObjectDAO needs to implement SomeObjectDAO.  Is that 
correct?

Still not sure what SomeObjectDAOFactory for yet.  


Here is a stupid beginner question:
Why do I need SomeObjectDAO interface if JT400SomeObjectDAO is probably the 
only class that will implement SomeObjectDAO? 

Can you or Collin give me a short info on how Ibatis or Hibernate help 
development cycle? 

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx]On Behalf Of
Niall.Smart@xxxxxxxxxxxxxxx
Sent: Tuesday, January 04, 2005 4:59 AM
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.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.