Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Feedback about JDBC over ORM

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,

I'm manager on a brand new project in my company that'll be a kind of ERP.

I plan to use JDBC over ORM frameworks due to SQL instructions complexity and amount of data used and rendered.

Do you think it is a good idea disregarding the quantity of "manual" work ?

Thanks in advance.
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Julien

If you have time and enthusiasm .... it is best always to reinvent the wheel because you learn how to make a new wheel ultimatelty..
But if you are on deadlines .... you can use work done by otheres like ...... using free and open source softwares like Hibernate !!!

If you want to know the advantages please read the documentation .......... or I will send you an intro why you need an ORM .....

Thanks if it helps you
 
Ci Kay
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your feedback.

I tried to use EclipseLink two weeks ago, but I give up when I got "Out of memory" in my JVM selecting 1,000 users :| that's why I'm posting here.

Maybe I did something wrong... but when I saw the amount of instructions the framework generated to find my users it turned me a little bit shocked
With JDBC I can only select fields I need, only join tables I want, in a optimized way.
 
Sandeep Kumar Jakkaraju
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Julien

You have to use the api ...intelligently ... there are some features like eager/lazy fetch ....

Thanks
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Maybe I did something wrong... but when I saw the amount of instructions the framework generated to find my users it turned me a little bit shocked
With JDBC I can only select fields I need, only join tables I want, in a optimized way.


Most ORMs will allow you to do this too. Selecting only the fields you need is a misguided optimisation - it makes no discernable difference to the load on the database server if you just select fields or entire rows and its the load on the database that matters because its usually easier and cheaper to provide more capacity in your application than in the database. Performing only the joins you need is a much more important thing; hence all ORMs will support lazy initialisation and direct fetching via a query language.

I don't know EclipseLink that well but it should have at the very least these sorts of capabilities. I would suggest though that it is designed to be a layer of abstraction on any data source, not just a relational one so will probably always loose out to a comparison with a technology solely focused on relational data. You might try looking at some ORMs rather than ones that cover every datasource.
 
author
Posts: 4173
29
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm on the fence on the JDBC vs ORM debate. For starters, with the exception of caching, JDBC is always faster since ORM resolves to JDBC in the end. Where ORM is better is for larger system with lots of tables and business objects. Also, it's preferable if your team isn't experienced in writing JDBC code. Otherwise, if you have a small system or need to execute a lot of really complex queries JDBC may be the way to go. I tend to rely on JDBC for report generation (large read-only queries) and ORM for everything else.
 
Ci Kay
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your feedbacks.

My team is used to write SQL code and the database model is around 30 tables, so I think I'll start with JDBC.

I tried to use eazy/fetch and partial loading, but in the end, I couldn't do exactly what I wanted and I think it's as long as writing manual queries and reuse them.

But I'll continue to inspect ORM frameworks and do some tests.
 
Scott Selikoff
author
Posts: 4173
29
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
30 tables is a lot of data though. Really what ORM buys you more than anything is a quick mechanism for writing data. You rarely (never?) have to write a single UPDATE/INSERT statement. The only problem with ORM is if you're writing long queries by hand often. If you plan to write to the 30 tables often, I'd definitely consider ORM more thoroughly.
 
Live a little! The night is young! And we have umbrellas in our drinks! This umbrella has a tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic