Trying to understand factory pattern - having some problems

hi,
I am tryin to learn the implementation of Factory design pattern and I came across this link after searching this forums:
http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html
My question is:
In the example they have different DAOFactories that have the database specific details like:
// Cloudscape concrete DAO Factory implementation
import java.sql.*;
public class CloudscapeDAOFactory extends DAOFactory {
  public static final String DRIVER=
    "COM.cloudscape.core.RmiJdbcDriver";
  public static final String DBURL=
    "jdbc:cloudscape:rmi://localhost:1099/CoreJ2EEDB";
  // method to create Cloudscape connections
  public static Connection createConnection() {
    // Use DRIVER and DBURL to create a connection
    // Recommend connection pool implementation/usage
  public CustomerDAO getCustomerDAO() {
    // CloudscapeCustomerDAO implements CustomerDAO
    return new CloudscapeCustomerDAO();
  public AccountDAO getAccountDAO() {
    // CloudscapeAccountDAO implements AccountDAO
    return new CloudscapeAccountDAO();
  public OrderDAO getOrderDAO() {
    // CloudscapeOrderDAO implements OrderDAO
    return new CloudscapeOrderDAO();
}But in my application I have stored all the database specific information in the server.xml of my tomcat server.So,how can I read different database configuration information for different databases like Oracle,Cloudbase,MySQL etc ????
Please help.

Thanks duffmo,
But atleast provide some link then that shows wats inHere's two:
http://www.springframework.org
http://www-128.ibm.com/developerworks/java/library/j-dao/
Personally, I don't worry about DAO factory classes.
If I have a class Foo that I want to persist I'll have a companion DAO interface that will look like this:
public interface FooDao
    public Foo find(long id);
    public List<Foo> findAll();
    public void saveOrUpdate(Foo foo);
    public void delete(Foo foo);
}There are more finders if I have other candidate keys.
I want to have all the datasource information out of
my code in server.xml,context .xml or some other xml
file from which my java code should read the
information,so which is the ideal way to do if you
want to make your application generic in the sense it
can be used with any database.Yes, I agree. Your database stuff will be in the Spring context and your app server's JNDI data source.
%

Similar Messages

  • My ipod touch will not switch on and is no longer recognised by itunes.  Before this i tried to restore it as I was having some problems with it switching off and on by itself randomly.

    My ipod touch will not switch on and is no longer recognized by itunes.  Before this i tried to restore it as I was having some problems with it switching off and on by itself randomly.
    I tried to restore it and I got error code 2009, so I closed it tried again got error code 1659, now it wont do anything and it's not recognized by my pc /itunes please help x

    For the restore error messages try:
    iTunes: Specific update-and-restore error messages and advanced troubleshooting

  • Have an HP Officejet Pro 8500 Wireless. Trying to print to it from my iPad2. Having some problems.

    I Have an HP Officejet Pro 8500 Wireless. Trying to print to it from my iPad2. Having some problems. Trying to print docs or files from the iPad usuall gets me a page that looks scrunched up to one side. Is there a good printer app (preferably free or shareware) that I could get or is there a patch, new driver, new firmware or something for the 8500 that would allow good printing fro the iPad wirelessly?

    The latest firmware version for your printer is DLM1FN1006BR; you can verify yours by printing out a self test page via the front panel of your printer. 
    Also, the HP ePrint Home & Biz app supports printing over your local wireless network, so please verify if your printer is connected to the same access point as your iPad2.  You are also able to verify connectivity by typing your printer's ip address within the address bar of your safari web browser.
    Say "Thanks" by clicking the blue Kudos Star in the post that helped you.
    Please mark the post that solves your problem as "Accepted Solution"; therefore, it's easier for others to find.
    I am an HP employee.

  • Having some problems with apps froms the app store

    Hello. Since I got my iTouch I've been having some problems with some apps. Some work perfectly fine, but some others are just crashing after a few seconds. I've tried everything I found, but it seems like my problem is different from the one related by lots of others iPod users. Here's a video a friend of mine who's having the same problems I am did showing it:
    http://www.youtube.com/watch?v=MI-gBhP_cgU
    It's really annoying us. Does anyone know how to fix it? Does it look like a firmware problem? Thanks in advance.

    Have youy tried:
    - Reset:
    Reset iPod touch:  Press and hold the On/Off Sleep/Wake button and the Home
    button at the same time for at least ten seconds, until the Apple logo appears.
    - iOS: Troubleshooting applications purchased from the App Store
    - Restoring the iPod from backup
    - Restoring the iPod to factory defaults/new iPod.

  • I'm having some problems wiht Firefox, for example; Youtube isn't loading right, Facebook won't let me send messages, search up people, and this website i made wont load right also. I've re-installed and updated it but still the same problems. Any help?

    I'm having some problems wiht Firefox, for example; Youtube isn't loading right, Facebook won't let me send messages, search up people, and this website i made wont load right also. I've re-installed and updated it but still the same problems. Any help?

    Because I know enough to be dangerous...  I was trying to extend the two outside columns down....  Instead of just using faux columns which I have fixed since I posted the question.
    The other link problem is the left sidebar links.  When you go to the event photos page I have a repeat of the sidebar links that are on the newsletter page.  I used named anchors on the newsletter page to link to the particular article.  From the Event Photos page the links look like this:
    <a href="1112Visions_Iss1.html/#puzzle" target="_self">[Puzzle]</a>
    The problem I am having is that some of these go to the newsletter page and the anchor and some do not (I get an error message saying it  can't find the page).  To add to the problem is that when we choose say the President's Message, when it goes to the newsletter page and the correct anchor, the newsletter page is missing all the links to the graphics... the photos are missing the graphic for the faux columns is missing.  It makes no sense.  When I preview the newsletter page from Dreamweaver everything shows up fine.
    I do not know if all of this is being caused because I haven't posted this stuff to the site or what.  I've tried re-booting both the browser and Dreamweaver, dumping the cache and still the same nonsense.
    Got any ideas?

  • Sorry, we're having some problems bringing you thi...

    every time I try to log in to ovi.com via computer to edit some informations I see this orry, we're having some problems bringing you this page. It's our fault not yours, so please try again later. Reloading the page may help I cant add or remove device.cant edit anything.also on mobile when I try to synchronise it says system error I tried to log in to ovi.com from different computers,different browsers,different methods/3g/,/adsl/,/wifi/ but I face the same problem am having this problem for more than one month and nobody seems to care.so I would like to know if am the only one who have this problem.thank you
    my blog on the net(in arabic):http://bazkurd.wordpress.com

    No, you are not alone. I cannot sync my tasks and I have also this message:
    Sorry
    Sorry, we're having some problems bringing you this page. It's our fault not yours, so please try again later.
    Reloading the page may help.
    Any suggestions for us?

  • Guys, good evenning! What is the most recently (or the best) iOS for the iphone 3G? Nowadays, i am using the 4.2.1 but i am having some problems to install apps from Apple Store because this iOS is not compatible with the apps. Thank You...

    Guys, good evening!
    What is the most recently (or the best) iOS for the iphone 3G?
    Nowadays, I'm using the 4.2.1, but I'm having some problems to install apps from Apple Store because this iOS is not compatible with the apps.
    Thank you very much...

    Thank You Niel!
    And if I install another version (eg 4.3), can I damage my iphone?
    This is the version required by the Apple Store when I try to install apps.
    For you understand better my problem, I'm not able to install simple apps like facebook and skype
    What do you advise me to do?
    Best regards,
    Jocemar

  • I just upgraded my iMac to Lion, and a few seconds ago, I upgraded the iWork package and now I'm having some problems with the new version of Pages (4.1) When I try to change something in a document, a message says "the program is not responding"

    I just upgraded my iMac to Lion, and a few seconds ago, I upgraded the iWork package and now I'm having some problems with the new version of Pages (4.1) When I try to change something in a document, a message says "the program is not responding", so I have to force it to close. By the way, the SAVE botton stays the same even I change erverything in my document. Please, a have a work to finish, **** me. What I can do abou it?

    I just upgraded my iMac to Lion, and a few seconds ago, I upgraded the iWork package and now I'm having some problems with the new version of Pages (4.1) When I try to change something in a document, a message says "the program is not responding", so I have to force it to close. By the way, the SAVE botton stays the same even I change erverything in my document. Please, a have a work to finish, **** me. What I can do abou it?

  • I downloaded the 09 version without deleting the 0, and now I am having some problems : when I open a document, it opens with 09, and then when I try to re-open it with 08 it is not possible !

    I downloaded the 09 version without deleting the 08 (didn't know), and now I am having some problems : when I open a document, it opens with 09, and then when I try to re-open it with 08 it is not possible ! I have a message saying tha "the fichier index xml is absent" (my computer is in French. I want to work with pages 08 until I get familiar with the 09 version. What shall I do ? What does this happen?

    Once you open the files in the new version you can't open them in the old version. Pick one version to use (have to be 9 now as you already have converted files)

  • I am having some problem to write র্যা (ro-a jofola akar) in indesign

    I am having some problem to write র্যা in indesign... I am not being able to write it there, where as it's possible in MS word. Can anyone suggest me what to do?

    Ar you using a font that has the required glyphs? Do you have the correct language assigned to the text (language is a character-level attribute, it is NOT set by choosing a dictionary in the prefs)? Is one of the World Ready composers turned on?
    What is happening when you try?

  • Hello, well im having some problems with my ipod 4th gen it will not turn on and when i plug it in to itunes it will not come up saying i need to restore. when i try that it will not compleet. the ipod will not do anything at all... please help me

    Hello, well im having some problems with my ipod 4th gen it will not turn on and when i plug it in to itunes it will not come up saying i need to restore. when i try that it will not complet. the ipod will not do anything at all... please help me i havent got  extra money to spend..

    Just what happens when the restore does not complete?
    Error message?
    Does it freeze? Is so what is listed in the status bar of iTunes?

  • We are having some problems viewing wide format drawings in safari on the ipad - The images view fine on the computer... Any ideas?

    We are having some problems viewing wide format drawings in safari on the ipad - The images view fine on the computer... Any ideas?

    No, the site isn't Flash-based; it's a site I've visited on the phone dozens of times. This problem only started occurring a few days ago.
    I'm embarrassed to admit that the site is Popsugar.com, a celeb gossip site that I visit whenever I'm bored.

  • I am having some problems finalizing the project, it says error code -108. I read some tips but i couldn't figure out what AppleMan1958 suggested ,can someone explain this to me ,thank you

    I am having some problems finalizing the project, it says error code -108. I read some tips but i couldn't figure out what AppleMan1958 suggested ,can anyone help me with this problem? thank you

    Oh ok, well that was what the test said prior to reformatting the hard drive. Now, it doesn't find any trouble no matter how many times I run it. That's what has me so confused, everything seems to check out and yet...I can't do anything, not even install the software!

  • I am having some problems setting up my new Airport Express! Can anyone help?

    I am having some problems setting up my new Airport Express.  I have registered it online, and downloaded all the new software, but for some reason it still doesn't work, and now my computer cannot find it! Anyone know what to do?

    Reset it and start again, use airport utility to find it (after the reset) and follow the instructions in the setup wizard.

  • Hi having some problems. flashing question mark!!!!!!!!!!!!

    hi iv been having some problems with my mac i was unable to start it up which had the new os x operating system was on it. it had a dreaded flashing question mark on startup. So i did the hold down option key start up manager thing. no luck it couldn't find the disk. So i looked on disk utility and got the message
    Invalid B-tree node size
    Volume check failed.
    Error: Filesystem verify or repair failed.
    disk would not repair. so intalled again on my other hard disk to get it up and running again. its sorted now but cannot get the old data off the original hard disk. it is still showing up on disk utillity but carnt do anything with it.
    hmmmmmmmm should of backed it all up me thinks...
    do you think i could retrive data on this?
    can anyone help me out on what to do i dont have a clue.
    cheers Jamie
    Message was edited by: jamie8286

    Hi Jamie, It sounds like the directory is corrupted or your HD is going bad.
    Did you check the system profiler and see if the S.M.A.R.T passed. Do you have TechTool or Disk Warrior? There are some programs out there that will allow you extract information from a dieing drive.
    The flashing question mark is telling you that it cannot find a functional operating system. And disk utility will only repair drives with a bootable OS.
    I know you said you did but, did you boot _from the install disc_ and run disc repair?
    I'll see what software for recovery there is for free.....

Maybe you are looking for