Aaron Bartell skrev den 05-07-2008 22:20:
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.
I found that the easiest to work with in JavaServer Faces (and probably elsewhere too) was to avoid writing POJO's for this with getters and setters, and just use Maps. Has the same JSF-syntax too.

If you need to do a lot of work with the same resultsets there are some tools with Hibernate that can automate the generation of POJO definitions and the mappings allowing Hibernate to do the dirty work between having objects and SQL tables.

But for presentation purposes Maps do nicely :)


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.