File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Feedback about JDBC over ORM Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Feedback about JDBC over ORM" Watch "Feedback about JDBC over ORM" New topic
Author

Feedback about JDBC over ORM

Ci Kay
Greenhorn

Joined: Feb 27, 2009
Posts: 4
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.


If you don't know where you're going, any road will get you there.
Sandeep Kumar Jakkaraju
Ranch Hand

Joined: Feb 25, 2009
Posts: 75
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

Joined: Feb 27, 2009
Posts: 4
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

Joined: Feb 25, 2009
Posts: 75
Hi Julien

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

Thanks
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


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.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

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.


My Blog: Down Home Country Coding with Scott Selikoff
Ci Kay
Greenhorn

Joined: Feb 27, 2009
Posts: 4
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
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3704
    
    5

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Feedback about JDBC over ORM