Announcement Announcement Module
Collapse
No announcement yet.
What's the best strategy to work with legacy DB with integrat. in differ. projects? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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, 06:04 AM.

  • #2
    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.

    Comment


    • #3
      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?

      Comment


      • #4
        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.

        Comment


        • #5
          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.

          Comment


          • #6
            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.

            Comment


            • #7
              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?

              Comment


              • #8
                I have seen data put in a relational database, that wasn't relational in any form.
                Being honest, I have to say that I didn't create this database; it's really an inheritance that I just got few moths ago. However, as a legacy Oracle database in production for more than 10 years, running in different countries, the people here really did the relational basic things. Of course, itís missing some techniques like use surrogate keys, normalize a little bit more to have a much better organization and so on, but the general concepts are there.

                with non-normalized tables and natural primary keys. I hope it can clarify better the situation.
                Not much.
                Would you mind to share what kind of information do you need in order to be possible to you evaluate these issues? I could send to you an example of some tables that I have in this database.

                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.
                I totally agree and I really have to considering the domain objects now that I have the POJOs, like Paul Newport and karldmoore have said. I am also glad that I am not wrong at all using the generate map tool (Paul Newport, thanks for your answer on that), because it also really saved us a lot of time generating our nearly 300 tables.


                If it's logical to have whole parts of the system shared between the two projects, why would you not do it?
                At this stage we are working in the development of the first subproject I mentioned (little one). We did the extraction from the database of the POJOs classes and we defined the domain using Strategy pattern. In this way and concerning the integration, the outsourcing would access only the entry point classes and, at the same time, it's expecting we have a good design using the Strategy pattern and Spring . The company will start their job in a couple of months from now, so they will need these classes, that I said before, only by that time. By the time they start their job, they will have the same access to the POJOs classes as we will. Thatís why I am asking if I use only the DAOs to access the POJOs classes (and consequently the legacy database), I will have most of my headaches fixed.

                I said that I have to start looking for the design of the generated POJO and it's seems a very ingenuous question, but why should I do that if itís only classes to access the legacy database through the DAOs? Is there adjustment that I have to apply in the generated POJOs?

                I hope I have answered your questions as well.

                Comment


                • #9
                  Originally posted by DistillingSpring View Post
                  Being honest, I have to say that I didn't create this database;
                  That is usually the case with legacy applications

                  Would you mind to share what kind of information do you need in order to be possible to you evaluate these issues?
                  I have some experience with legacy databases: I just finished a project that needs to deal with loads of legacy systems (en databases). I guess that most legacy database have some unique 'problems' that have grown into the system over time. So I can't provide any guidelines because there are so many strange problems.

                  I just have a gut feeling, that generating Java code based on a legacy database is a bad thing. You can do whatever you want with this information.

                  I could send to you an example of some tables that I have in this database.
                  Please not I guess it is going to take a lot of time to see how it all sticks together.

                  Comment


                  • #10
                    I will have some information related with what I have done, right and wrong, in a few months. Then, I hope to have good news to post here after the information provided by all of you.

                    Thanks.

                    Comment


                    • #11
                      Originally posted by DistillingSpring View Post
                      I will have some information related with what I have done, right and wrong, in a few months. Then, I hope to have good news to post here after the information provided by all of you.
                      Good luck with it all! Look forward to hearing your experiences, hopefully positive .

                      Comment

                      Working...
                      X