Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   O/R Hell (http://www.velocityreviews.com/forums/t388604-o-r-hell.html)

JavaEnquirer 11-14-2006 02:08 PM

O/R Hell
 
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.


David Segall 11-14-2006 02:55 PM

Re: O/R Hell
 
"JavaEnquirer" <javaenquirer@hotmail.co.uk> wrote:

> 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.

Have you looked at Java Studio Creator
<http://developers.sun.com/prodtech/javatools/jscreator/index.jsp>?
It's an easy to use RAD tool that produces Java Server Faces
applications. The functionality is also available in Netbeans
<www.netbeans.org>.

Alex Hunsley 11-14-2006 03:32 PM

Re: O/R Hell
 
JavaEnquirer wrote:
> 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.

WuyaSea Operator 11-14-2006 11:22 PM

Re: O/R Hell
 
3 words, ruby on rails. dead simple.


JavaEnquirer wrote:
> 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.



warren.mayocchi@gmail.com 11-24-2006 04:07 AM

Re: O/R Hell
 
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>(JellyCompa ny.class);

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



All times are GMT. The time now is 02:59 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.