Results 1 to 10 of 11

Thread: What's the best strategy to work with legacy DB with integrat. in differ. projects?

Hybrid View

  1. #1

    Default What's the best strategy to work with legacy DB with integrat. in differ. projects?

    Hello,

    I have a big decision to make for a system that's going to production. My project is composed by two sub-projects: One little one which we will develop in-house using Spring + Hibernate + Oracle, which I have business classes domain that are part of this specific module. Another -- big one -- which has to integrate with the first one, will be developed by a software company (using the same software architecture + JSF). Additionally, the both sub-projects have to access a legacy database and I already have the map files for the Hibernate generated by Middlegen.

    My questions are:
    1. What's the best strategy to integrate software that has been developing in house with a project that WILL be developed in an outsourcing company (I am using strategy Pattern and Spring, of course, but I am not sure that what I have done can fix all the issues that I could face in the near future)?

    2. What's the best strategy for the both projects be able to access the map files generated by the Middlegen (POJOs classes), that are from the legacy database that I cannot touch (natural primary keys by the way)? Would be an option use only the DAOs -- wired in the Spring -- for the POJOs classes and both projects accessing these DAOs or is there other better option?

    I would like to join what I have read in the Spring documentation and books with your real world experience.

    Thank you so much for any comment.
    Last edited by DistillingSpring; Feb 27th, 2007 at 05:04 AM.

  2. #2
    Join Date
    Nov 2004
    Location
    Hilversum - The Netherlands
    Posts
    1,054

    Default

    I don't know how useful generation POJO's based on a legacy database is. With non legacy databases, it already is tricky, but with legacy databases the usefulness of generated domain objects will be even lower.

    So I would really reconsider automatically generating stuff. Hibernate is quite powerful to map legacy database if you add some manual mapping. But if it is truly legacy (like hierarchical data in relational databases, non normalized tables and other nasty stuff) I would rather use JDBC in combination with a thin layer on top of that (Spring with the JDBC support, or IBatis).

    But I don't know enough of the database schema to see what kind of troubles you are going to encounter.

  3. #3

    Default

    Thanks for your answer. It's a relational database (Oracle) with non-normalized tables and natural primary keys. I hope it can clarify better the situation.

    I found that Middlegen did a very good job, what the point that wouldn't be good to use it?

  4. #4
    Join Date
    Nov 2004
    Location
    Hilversum - The Netherlands
    Posts
    1,054

    Default

    Quote Originally Posted by DistillingSpring View Post
    Thanks for your answer. It's a relational database (Oracle)
    I have seen data put in a relational database, that wasn't relational in any form.

    with non-normalized tables and natural primary keys. I hope it can clarify better the situation.
    Not much.

    I found that Middlegen did a very good job, what the point that wouldn't be good to use it?
    Middlegen maybe did a good job at generating pojo's that can be persisted, but how useful are those objects as domain objects? That is something I question even with a non legacy database.

  5. #5
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    Personally I thought Middlegen did a pretty decent job of what I expected from it. Generate some classes for the tables in the database. It's just like any code generation tool, click the big button and generate some stubs. It did initially save us some typing and some time, but after that the real work began.

  6. #6
    Join Date
    Sep 2006
    Location
    UK
    Posts
    8,424

    Default

    I've just read the original problem, think I might have strayed somewhat. As for the development approach, I think it very much depends on where the projects are currently at and what kind of relationship your two teams are going to have. I've worked with outsourcers a couple of times. It was very interesting and very frustrating. If you are both going to have a shared code base, I would try and define some clear ownership boundary. I would also try and work as closely as possible with both teams. If it's logical to have whole parts of the system shared between the two projects, why would you not do it?

  7. #7
    Join Date
    Sep 2004
    Posts
    602

    Default

    Quote Originally Posted by DistillingSpring View Post
    Thanks for your answer. It's a relational database (Oracle) with non-normalized tables and natural primary keys. I hope it can clarify better the situation.

    I found that Middlegen did a very good job, what the point that wouldn't be good to use it?
    I think what you have done is fine. With a legacy database you probably don't have a domain model anyway, so POJOs generated by middlegen are a lot better than nothing, and you'll still gain a lot by using Hibernate

    e.g. very simple DAO code, caching, lazy loading, optimistic locking and so on.

    You are on the right track.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •