3 Replies Latest reply on May 4, 2004 6:22 AM by Jon Barnett

    JDBC vs. Hibernate

    itchyoinker Newbie

      Can you please tell me what you think about using JDBC directly instead of Hibernate for small applications?

      Here are some facts about my apps:
      1). usually about 35 database tables
      2). use JBoss application server for db Connection
      3). POJOs as DAOs, wrapped in Session Beans

      Whereas I see Hibernate as a good solution for larger projects, the setup time is killing my budget. It's been several days and I still can't get XDoclet to generate my mapping files.

      Wouldn't it be easier to just get a connection from JBoss and program JDBC directly from DAOs (POJOs) wrapped by Session Beans?

      After all, I could still take advantage of JBoss' Connection and Session Bean pooling and security, right?

      Am I making a big mistake by using JDBC directly from within JBoss?

      I guess my main concern is making my SMALL apps reliant on too many different and hard-to-configure components. Your comments and thoughts, no matter how brief, would be greatly appreciated.

      Regards,
      Itchy

        • 1. Re: JDBC vs. Hibernate
          Steve Lewis Expert

          Try doing the mapping files yourself. That's what I've done and I was up and running with Hibernate very quickly. The relationships are a little tricky, but not really too bad, and the documentation is pretty good. If all else fails, the source is always there.

          You may just need to study up on XDoclet. It seems simple enough but then again I haven't taken the time to learn it :D

          Steve

          • 2. Re: JDBC vs. Hibernate
            itchyoinker Newbie

            Hi Steve,

            I thought about doing it that way, but keeping separate mapping and class files seems like too much maintance for a production app. And after spending many unsuccessful days simply trying to get XDoclet to generate mapping files, learning Hibernate is just no longer in our budget...at least for this project. I'll keep tinkering with it on-the-side, but for now I need to produce some results direcly with JDBC.

            Thanks for your encouragement--I do appreciate all ideas.

            Itchy

            • 3. Re: JDBC vs. Hibernate
              Jon Barnett Master

              If you already have POJOs and the code is well tested, then converting them to DAOs is cost-effective and quick. Particularly if the data model is stable and not likely to change greatly. Otherwise you would use entity beans or Hibernate to accommodate rapid change easily. Common sense rather than FAD should rule. MHO.