Looking for Light-Weight SQL-Centric Java Persistence Methodology

Being very proficient in SQL, I am looking for some method or framework which begins with SQL queries of arbitrary complexity and generates appropriate mapping. To date, all of my Java programs have utilized plain JDBC calls with no reuse -- which I know isn't really good programming technique. But it does work.

So, something that would maximize my facility with SQL and bind it to Java GUI objects with minimal overhead is what I am hoping to find.
gwiensxRetiredAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ksivananthCommented:
try mybatis, previously ibatis http://www.mybatis.org/
0
Sharon SethCommented:
An ORM , like ibatis , toplink or hibernate , in turn uses JDBC to genertae the final SQLs . It is like introducing one more layer between the database and Java GUI in your existing setup . If the concern is only about reuse , why not go about reorganising the DAO classes instead of  using an ORM .
0
ksivananthCommented:
>>in turn uses JDBC to genertae the final SQLs . It is like introducing one more layer between the database and Java GUI in your existing setup
>>

your logic is like, HTTP implementation is in son top of plain socket why not code with plain socket for http access?

and extra layer? not at all, you are going to just replace your JDBC code with ORM API which more clean, deals with entities directly so no overhead of traversing resultset and populate your bean.

>>why not go about reorganising the DAO classes instead of  using an ORM

when you code with direct JDBC, you'll tend to code with hardcoded SQL which makes not reusable. I would say go with existing ORM tool( IBatis is the lightweght in all and widely used ) unless you have hard need to have your own orm framework
0
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

gwiensxRetiredAuthor Commented:
Appreciate comments and suggestions. I am evaluating them even as I am trying to understand the nuances which are implicit in various options.
0
Sharon SethCommented:
I believe gwiensx had said he wants to use his proficiency in SQL . Will an ORM allow him to ? It would generate the SQLs for him instead , which may not always be optimized .  If there are many database tables in the system , it is sensible to use an ORM for better management. That was what I meant :)
0
gwiensxRetiredAuthor Commented:
shareonseth -- your last comment is right on, and I think you see what I am trying to (clumsily) express  ie; replace endless repetition of code sequences (connection strings, connection urls, and embedded SQL) in my presentation with some minimal  encapsulation -- one that would let me access my debugged and optimized queries without all of the JDBC wiring required to be embedded in GUI code.

Assuming that I am much more proficient in SQL than Java, what might be the drawbacks of using DAO? Would you still recommend this approach? If so, could you elaborate, then, on "reorganizing DAO"?

Thanks
0
Sharon SethCommented:
DAO is an approach you got to have irrespective of whether you use plain JDBC or an ORM framework. DAO  cleanly decouples  your  UI/business tier from  the underlying database procedures/processes .  What did I mean when I said "reorganizing DAO" - I meant  you could have all the connection strings , URLS and SQL strings in the DAO layer .  You expose appropriate methods for  opening and cleaning up the connections and all DB related activities . Now , the UI should only be using these exposed methods , instead of directly opening connections with the connection strings/URLs.

As ksivanath pointed out , plain JDBC/prepared statements provide minimal or no reuse . An ORM definitely allows you to keep the system more organized and you would achieve better readablility and managebility . On the other hand , you will have limited control or even no control over the final SQLs fired on the database .  It is very good to have reusability , but reusability is not everything that we need to think about . Well , as it is always said , good programming is all about putting the right thing in place as per the situation.  I would personally use an ORM when I have many  database tables lying around , and one click on the UI would have to cascade updates to around 10 - 15 tables . If the underlying  database work is fairly less , then I would rather try to take advantage of my SQL  proficiency and fire my own SQL .
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gwiensxRetiredAuthor Commented:
I appreciate all responses to my question. From my own attempts to understand abstracting the db layer, I have been drawn to myBatis. In the end, however, I would am going to try the approach suggested by sharonseth:- that if the database work is minimal (which it is at this point), then use DAO for minimal separation.

Rating this Q&A was difficult since I have not had time to implement suggestions. However, since this question was apparently at risk of becoming tagged as stagnant, it is what it is.

Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.