The Artima Developer Community
Sponsored Link

Java Buzz Forum
SQLAlchemy for Java

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Elliotte Rusty Harold

Posts: 1573
Nickname: elharo
Registered: Apr, 2003

Elliotte Rusty Harold is an author, developer, and general kibitzer.
SQLAlchemy for Java Posted: Jun 28, 2007 4:06 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Elliotte Rusty Harold.
Original Post: SQLAlchemy for Java
Feed Title: Mokka mit Schlag
Feed URL: http://www.elharo.com/blog/feed/atom/?
Feed Description: Ranting and Raving
Latest Java Buzz Posts
Latest Java Buzz Posts by Elliotte Rusty Harold
Latest Posts From Mokka mit Schlag

Advertisement

Anyone know of an equivalent of the SQLAlchemy Python data binding library for Java? SQLAlchemy lets you map Python classes to the records in a table. What distinguishes it from Java-based ORM tools that I’ve seen such as Hibernate is that in SQLAlchemy you can map any table, not just ones that actually exists in the database.

SQLAlchemy doesn’t view databases as just collections of tables; it sees them as relational algebra engines. Its object relational mapper enables classes to be mapped against the database in more than one way. SQL constructs don’t just select from just tables—you can also select from joins, subqueries, and unions. Thus database relationships and domain object models can be cleanly decoupled from the beginning, allowing both sides to develop to their full potential.

In other words, with SQLAlchemy you can make statements like SELECT Student.Name, Exam.Grade FROM Students, Exams WHERE Students.ID=Exams.Student_ID and map classes to the table this statement returns. Hibernate, by contrast, really, really believe in the concept of at least one-class per table. A single class that crosses multiple tables is beyond it. In Hibernate you have to map classes to the physical database tables (or perhaps views, not sure about that) and then do your queries against the objects in HQL instead of against the tables in SQL. The you spend a ridiculous amount of time logging the SQL statements it actually generates and trying to figure out how to optimize them. By contrast, since SQLAlchemy’s query language is SQL, it’s much easier to let the database do the heavy lifting.

The downside of SQLAlchemy is that it’s very easy to put yourself in a situation where updates just aren’t possible. However, for many applications read-only access is what you need anyway.

Maybe iBatis?

Read: SQLAlchemy for Java

Topic: Shunra VE Desktop 3.0 Previous Topic   Next Topic Topic: Bea Kodo, OpenJPA or what?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use