× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Nathan-

Some/most of the Spring docs are not the most straight-forward. Spring
has many subprojects, but the Spring JDBC template does not depend on
any of them. I have one JAR file from Spring in my classpath. (
spring.jar )

Did you review the sample DAO code I posted to this list?

Is that to say that Spring "automatically" maps SQL result sets into collections of objects?

When the Spring method deals with a result set with more than 1 row,
the default behavior is to return a Map. The key names are identical
to the field names from the result set. In the DAO example I posted
to this list, I overrode that behavior so that it returns a List of
pojos.

When the Spring method deals with a result set with just 1 field, it
returns an object such as a String or Integer. ( this is handy for
when I do a "SELECT count(*)" or "SELECT sum(*)"

I learned about Spring initially from in-person training. When the
instructor presented the JDBC template API, my initial reaction is
that this would be perfect for anybody coming to Java from the RPG or
COBOL world. ( Or anyone who doesn't like writing boiler-plate code
just to get some stuff out of a database. ) I have no doubt you could
write your own DB API for RPG programmers, but I don't know how you
would improve on the JDBC template API.

-Sarah








On Sat, Jul 5, 2008 at 2:24 PM, Nathan Andelin <nandelin@xxxxxxxxx> wrote:
From: Sarah Poger Gladstone
Have you seen Spring's JDBC template API?

Sarah,

I spent a couple hours reviewing Spring articles and documentation. But I didn't learned much. The terminology is beyond me. I was an early adopter of OO languages and runtime interfaces (in the mid 90's). But I switched to ILE in the late 90's, and many OO concepts and terms have morphed since then. Plus Spring is a huge collection, divided into 7 major frameworks.

In just 2 lines of code a programmer can: query the database
( with parms) and return the result(s) into a hashmap or
collection of objects.

Is that to say that Spring "automatically" maps SQL result sets into collections of objects? It may be safe to say that SQL result sets are "collections", but not "objects" in the same sense as Java objects. The SQL runtime doesn't support extending result sets through inheritance (or polymorphism), for example. And methods may be "applied" to result sets, rows, & columns, but are not embedded in the same.

So there must be something that maps SQL result sets to objects. Is it automated? Is it based on column data types? Since column attributes may include such things as text headings and edit codes, are they mapped as well?

Finally, what is the purpose of mapping SQL result sets into objects? Based on other comments in this thread, I assume it has something to do with implementing business rules and procedures. But I shouldn't assume.

Thanks,

Nathan.



--
This is the Web Enabling the AS400 / iSeries (WEB400) mailing list
To post a message email: WEB400@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/web400.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.