• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

changing databases efficiently

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 )
 
What do you have to say for yourself? Hmmm? Anything? And you call yourself a tiny ad.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic