Finally, what is the purpose of mapping SQL result sets into objects?

My approach in Java and corresponding frameworks is to load each SQL result
set entry into a single POJO (Plain Old Java Object, which you could equate
to an RPG data structure) and then that POJO is loaded into a Java
Collection (I use Vector and ArrayList objects mostly). Once the array of
objects is in a "Java medium" it can be easily passed about from one layer
to the next without having to be tied to any particular framework, DB, etc.

A similar approach in RPG would be to have a data structure array that was
filled with records and passed from one sub proc to the next. Building a
layer around this on the RPG end is *as* necessary as it is in the Java
environment simply because in RPG we don't have the same complexities as
other languages/platforms have when communicating with the database. In the
end, any remapping of DB query results to RPG mediums should ALWAYS be based
on things like reuse, hiding complexity, shop standards, etc.

HTH,
Aaron Bartell
http://mowyourlawn.com


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

Follow-Ups:
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.