This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Which J2EE Pattern(s) we must used?

 
jai walia
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers,
My team is planning to develop an order management application for a specific domain. Here we have our own database(Oracle) for the data capturing purpose. Currently we are planning to use DAO,TO and Singleton pattern (plus other as progresses). But during analysis we got to know that we have to pick certain data from other database (MySQL) in a order entry form at run time against a business key. So here, we are expecting 2 database connection (Using JNDI), one (Oracle) for the whole application and second (MySQL) for one time, at the time of order entry.

So, My query how to intermingle with DAO pattern (if possible) with 2 connections, or will it require some other pattern?
Waiting for your reply....
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your implementation of the Data Access Object design pattern will need to be able to handle communication with two databases. Whenever your business object communicated with a DAO, it will need to indicate which database it should work with. This can be done via method signature in the DAO call.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just create one DAO instance for one DB and another DAO instance for another DB.

If this doesn't fit in your current DAO design, then it might be plain flawed. To start, only the word 'singleton' in combination with 'DAO' already doesn't sound very good.
 
Jelle Klap
Bartender
Posts: 1951
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could combine the basic DAO pattern with the abstract factory pattern, as suggested by the DAO entry in the Core J2EE Pattern Catalog.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic