• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

changing databases efficiently

 
David Pantale
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Does anyone have a good suggestion on how to set up the code to efficiently change from the project database to a commercial database? Right now I have a business services layer that has a data layer object reference and simply calls the data layer methods and passes in the data. For example: datalayer.updateData(recordNum, lockCookie);

This works, but I'm sure there must be a better way to setup the application to switch from the homegrown db to a commercial app. Any suggestions?

Thanks

Dave
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have trouble with understanding what your asking.

Now your application works with a flat database file. You have an interface and 1 implementation. If the company decides to use a rdbms (like mysql) instead of the flat database file, you have to implement the given interface a second time. The current implementation (Data class) will be replaced with this new implementation and the application will still keep working.
 
David Pantale
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry about that, I phrased the post poorly. I guess I'm just curious about how other people handled the problem of setting up their application to deal with the issues of using different databases. I know someone (you?) did a dao factory pattern.

Dave
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Pantale wrote:I know someone (you?) did a dao factory pattern.

Yes, that was me I stuck very close to the instructions and developed only the "must" requirements, except this dao factory pattern. In my opinion it really has a lot of added value, it gives you tons of flexibility. You can simply extend your application with another DAO (one for customers for example), when you have different DAOs you can easily stick to the one for flat database file for customers and already start using a MySql-based one for bookings,...
 
David Pantale
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you explain in a little more detail how you did it? I'm thinking maybe I should do the same.

Thanks
Dave
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is nothing much I can tell about it. I just added the dao factory pattern and I use this factory to retrieve the appropriate instance of my dao (data class). So the only public api from the db-package are the interfaces and this factory. So classes from other packages don't know about the existence of the Data class.

I believe I used this link as one of my resources (it has been a long time ago )
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic