O/R Hell

J

JavaEnquirer

I don't "get" Hibernate. ( At least for the kinds of projects I work on
- small/medium information systems, nothing too complex, the kind of
thing you could do with Microsoft Access. )

I don't want to jump through hoops to map my ResultSets into objects
and I don't need to worry about the back-end database changing - it
just won't!! Hibernate should do the trick, but I find it so damn
awkward, time consuming and fussy, full of features I'll never need.
Stupid I know, but you can feel is if you are doing something wrong if
you are not using the "in" technologies. For me, I don't want to have
to type in more than the following:

StoredProcedureExecuter executer =

StoredProcedureFactory.getStoredProcedureExecuter("connectionAlias",
"mySp");
executer.addParams(param1, param2, param3);

ArrayList<Customer> customerList = ResultSetMapper.map(Customer.class,
executer.execute());

executer.close();

The above is rough, off the top of my head example of how I do things
on my projects. No mapping required, everything handled by reflection
and db naming conventions. Seems far easier than Hibernate. However,
it's not a complete framework, and we sometimes go back to vanilla JDBC
for complex joins and for changing data. I was wondering if there's a
library/tool out there that's as easy to use as the code snippet shown
above, but is more complete and powerful. I'm thinking of something
akin to a database version of Wicket - no XML and using the best tool
for the job i.e. writing stored procedures using the DB vendor's tools
and wizards, no thrashing around wondering what columns are in what
tables, entering typo hell and debugging the tag soup.

Any ideas anyone? I don't enter the J2EE world often and when I do it
scares me. Java doesn't seem to be getting that much easier. Our outfit
is thinking of moving to some kind of new 4GL Rad tool for quickly
knocking out the 80% of simple stuff we do, and using .NET for the
trickier stuff. I'm finding it increasingly hard to justify our use of
Java to myself.
 
A

Alex Hunsley

JavaEnquirer said:
I don't "get" Hibernate. ( At least for the kinds of projects I work on
- small/medium information systems, nothing too complex, the kind of
thing you could do with Microsoft Access. )

I don't want to jump through hoops to map my ResultSets into objects
and I don't need to worry about the back-end database changing - it

Have you looked at Torque?
http://db.apache.org/torque/
Lightweight ORB. May do the trick - simpler than hibernate, that's for sure.
 
W

warren.mayocchi

Have a look at ResultSetMapper
(http://resultsetmapper.sourceforge.net):

//---------------------------------------------------------
public class JellyCompany {
@MapToData
String companyName;
@MapToData ( columnAliases= { "company_address" } )
String address;
...
}

//---------------------------------------------------------
ResultSet results = stmt.executeQuery("SELECT * FROM jelly_companies");

ResultSetMapper<JellyCompany> resultSetMapper = new
ReflectionResultSetMapper<JellyCompany>(JellyCompany.class);

while (results.next()) {
JellyCompany jellyCompany = resultSetMapper.mapRow(resultSet);
// Order some jelly beans.
}
//---------------------------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top